您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

css如何设置竖排文字

2024/3/25 1:03:50发布19次查看
css设置竖排文字的方法:1、通过“word-wrap: break-word;”等属性实现单个竖排文字;2、通过“writing-mode: tb-lr”等属性实现多行竖排文字;3、通过“rotate(90deg);”实现整体竖向排版。
本文操作环境:windows7系统、html5&&css3版,dell g3电脑
css几种简单方法实现文字竖向排版
下面介绍几种使用css实现文字竖向排版的方法:
1.一个句子的竖向排列
如图:
<!doctype html>  <html>  <head>      <title>test</title>      <meta charset="utf-8">  </head>  <style>  .one {      width: 20px;      margin: 0 auto;      line-height: 24px;      font-size: 20px;}.two {      width: 15px;      margin: 0 auto;      line-height: 24px;      font-size: 20px;      word-wrap: break-word;/*英文的时候需要加上这句,自动换行*/  }  </style>  <body>      <p class="one">我是竖列排版</p>      <p class="two">i am english</p>  </body>  </html>
2.多个句子竖向排列(如古诗)
如图:
<!doctype html>  <html>  <head>      <title>test</title>      <meta charset="utf-8">  </head>  <style>  .one {      margin: 0 auto;      height: 140px;      writing-mode: vertical-lr;/*从左向右 从右向左是 writing-mode: vertical-rl;*/      writing-mode: tb-lr;/*ie浏览器的从左向右 从右向左是 writing-mode: tb-rl;*/  }  </style>  <body>      <p class="one">欲话毗陵君反袂,欲言夏口我沾衣。谁知临老相逢日,悲叹声多语笑稀。</p>      <p class="one">i am english</p></body>  </html>
3.字体横行,整体竖向排版
如图:
<!doctype html><html><head>    <title>test</title>    <meta charset="utf-8"></head><style>.one {    margin: 150px auto;    width: 200px;    font-size: 20px;     line-height: 24px;    transform:rotate(90deg);    -ms-transform:rotate(90deg);     /* ie 9 */    -moz-transform:rotate(90deg);     /* firefox */    -webkit-transform:rotate(90deg); /* safari 和 chrome */    -o-transform:rotate(90deg);     /* opera */}</style><body>    <p class="one">欲话毗陵君反袂</p>    <p class="one">english</p></body></html>
推荐学习:《css视频教程》
以上就是css如何设置竖排文字的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product