CSS样式:属性

本是古典 何须时尚 2023-07-19 05:58 109阅读 0赞

CSS有多种属性,根据继承性,主要可以分为2大类
(1)可继承属性
父标签的属性值会传递给子标签;
一般是文字控制属性;
如:
所有标签:visibility、cursor;
内联标签:line-height、color、font、font-family、font-size、font-weight、text-decoration;
块级标签:text-indent、text-aling;
列表标签:list-style

(2)不可继承属性
父标签的属性值不能传递给子标签;
一般是区块控制属性;
如:display、margin、border、padding、background;
height、min-heignt、mex-height、width、min-width、max-width;
overflow、position、left、right、top、bottom、z-index;
float、clear;
table-layout、vertical-align;
page-break-after、page-brean-before;
unicode-bidi;

  1. div{
  2. /*字体设置*/
  3. color: orange;
  4. font-size: 20px;
  5. font-family: "Adobe Hebrew";
  6. font-weight: bolder;
  7. text-align: center;
  8. /*边框设置*/
  9. border-color: purple;
  10. border-radius: 5px;
  11. /*背景设置*/
  12. background-color: green;
  13. background: url("http://p3.pstatp.com/large/1940000367b378b1260d");
  14. background-size: 50%;
  15. /*display: none;*/ /*隐藏不可见,且不占位置*/
  16. /*visibility: hidden;*/ /*隐藏不可见,仍占位置*/
  17. cursor: pointer; /*改变属性显示*/
  18. /*段落设置*/
  19. text-indent: 30px;
  20. text-decoration: none;
  21. }

发表评论

表情:
评论列表 (有 0 条评论,109人围观)

还没有评论,来说两句吧...

相关阅读

    相关 CSS字体样式属性

    font-size:字号大小 font-size属性用于设置字号,该属性的值可以使用相对长度单位,也可以使用绝对长度单位。其中,相对长度单位比较常用,推荐使用像素单位px,绝