CSS竖排怎么换行?

html-css040

CSS竖排怎么换行?,第1张

一、使用writing-mode属性语法:writing-mode:lr-tb或writing-mode:tb-rl参数:1、lr-tb:从左向右,从上往下2、tb-rl:从上往下,从右向左运行代码发现,ie显示正常,火狐却不行,所以不建议使用writing-mode属性,下面使用模拟方法实现。 二、模拟文字竖排代码:ul{width:100pxheight:80pxoverflow:hiddenlist-style:none}ul li{float:rightdisplay:inlinemargin-left:4pxwidth:14pxheight:100pxfont-size:14pxword-wrap:break-wordword-break:nomal}此方法让li右浮动,设置li宽度和字宽度一样都是14px,这样就自动换行了。另外,“word-wrap:break-wordword-break:nomal”这句实现标点自动换行(连续字符自动换行)。

你是css3吗?可以用writing-mode: tb-rl

例子:

<html>

<head>

<style type="text/css">

div.one

{

height:300px

writing-mode: tb-rl

}

</style>

</head>

<body>

<div class="one">Some text. Right-to-left direction111111111111.</div>

</body>

</html>

将class 放到<td>中,去掉<div>和</div>即可

<html>

<head>

<title>HTML表格中竖排文字问题</title>

<style type="text/css">

<!--.tnt {Writing-mode:tb-rlText-align:leftfont-size:20pt}-->

</style>

</head>

<body>

<table border="1" width="300" height="600" style="color:red">

<tr height="300">

<td>

<div class="tnt">我爱中国</div>

</td>

</tr>

<tr>

<td class="tnt">

我爱中国

</td>

</tr>

</table>

</body>

</html>