css3 中text-align:justify

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>

效果图:

170303_v2xD_1250113.png

css3伪元素 ---------- ::selection

    定义和用法

    ::selection 选择器匹配被用户选取的选取是部分。

::selection{
    background:#f00;
    color:#00f;
}
::-moz-selection{
    background:#f00;
    color:#00f;
}

该伪元素只能设置两个属性background和color,设置其他属性不起作用。

兼容的浏览器:

::selection在IE家族中,只有IE9+版本支持,在Firefox中需要加上其前缀“-moz”


转载于:https://my.oschina.net/zyxchuxin/blog/488749

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值