在html中使用text-align:justify;text-justify:inter-ideograph,就能使文字两端对齐,但chrome不支持这种方法,该如何写html或CSS代码,使得在chrome中文字两端对齐呢?
看下面的代码:
使用CSS实现文本两端对齐.test1 {
text-align:justify;
text-justify:distribute-all-lines;/*ie6-8*/
text-align-last:justify;/* ie9*/
-moz-text-align-last:justify;/*ff*/
-webkit-text-align-last:justify;/*chrome 20+*/
}
@media screen and (-webkit-min-device-pixel-ratio:0){/* chrome*/
.test1:after{
content:".";
display: inline-block;
width:100%;
overflow:hidden;
height:0;
}
使 用 CSS 实 现 文 本 两 端 对 齐
由于chrome浏览器没有考虑中文的分词,所以还得在文字中间加上空格