码迷,mamicode.com
首页 > Web开发 > 详细

css3 中text-align:justify

时间:2015-08-06 18:54:21      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:

css3中text-align:center:justify;

这个属性是单词两端对齐的意思。 

值justify可以使文本的两端对齐。在两端对齐的文本中,文本行的左右两端都放在父元素的内边界上。然后,调整单词和字符间的间隔,使各行的长度恰好相等。

举例:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>css中display:justify</title>
    <style>
    .box1{ width:500px; line-height:20px; margin:10px auto; background-color:#cdd; text-align:justify;}
    .box2{ width:500px; line-height:20px; margin:10px auto; background-color:#cdd; text-align:left;}
    </style>
  </head>
  <body>
      <div>There is clearly a need for CSS to be taken seriously by graphic artists. The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The code remains the same, the only thing that has changed is the external .css file. Yes, really</div>
      <div>There is clearly a need for CSS to be taken seriously by graphic artists. The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The code remains the same, the only thing that has changed is the external .css file. Yes, really</div>
  </body>
</html>

效果图:

技术分享

css3 中text-align:justify

标签:

原文地址:http://my.oschina.net/zyxchuxin/blog/488749

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!