H5、CSS、JS

CSS-文字段落属性(+)

2016-05-03  本文已影响125人  前端历险记

列个工作中用的CSS段落清单,方便随时查看。
对CSS属性的遗忘,一半是对英文涵义不做了解,再者是有些属性不常用,一来二去即便简单的内容,都要反复查找。

html

<h1>this is heading 1</h1>
<h2>this is heading 2</h2>
<h3>this is heading 3</h3>
<h4>this is heading 4</h4>

css

h1{
  // 帽子
  text-decoration:overline;
}

h2{
  // 腰带
  text-decoration:line-through;
}

h3{
  // 鞋子
  text-decoration:underline;
}

h4{
  // 光脚
   text-decoration:none;
}

效果见链接text-decoration

css

#div1{
    white-space:nowrap; // 取消限制,内容不换行
    overflow:hidden; // div内容隐藏
    text-overflow: ellipsis; // 文本省略
}

适用于新闻摘要,效果见链接 w3schools

normal正常
nowrap 不换行
pre 不换行-前加空白段
pre-line 换行-前加空白段,暂未用到
pre-wrap换行-前加空wrap,暂未用到
initial初始化,同normal
参考链接w3schools


此方法用于文字写作习惯,属于CSS3,不过ie8+是部分支持一些基本属性:

writing-mode:lr-tb 由左向右,从上到下
writing-mode:tb-rl 从上到下,由右到左

word-wrap: normal|break-word;

上一篇 下一篇

猜你喜欢

热点阅读