当面试官问CSS可继承属性有哪些?

190 阅读1分钟

当面试官问CSS可继承属性有哪些?就这样告诉他:

有继承性

  1. 字体系列
    font、font-family、font-weight、font-size、font-style、font-variant、font-stretch、font-size-adjust
  2. 文本系列
    text-indent、text-align、line-height、word-spacing、letter-spacing、text-transform、direction、color
  3. 元素可见性
    visibility
  4. 表格布局属性
    caption-side、border-collapse、border-spacing、empty-cells、table-layout
  5. 列表布局
    list-style-type、list-style-image、list-style-position、list-style
  6. 光标
    cursor

无继承性

  1. 生成内容属性
    display。
  2. 文本属性
    vertical-align、text-decoration、text-shadow、white-space、unicode-bidi。
  3. 盒子模型的属性
    width、height、margin、margin-top、margin-right、margin-bottom、margin-left、border、border-style、border-top-style、border-right-style、border-bottom-style、border-left-style、border-width、border-top-width、border-right-right、border-bottom-width、border-left-width、border-color、border-top-color、border-right-color、border-bottom-color、border-left-color、border-top、border-right、border-bottom、border-left、padding、padding-top、padding-right、padding-bottom、padding-left。
  4. 背景属性
    background、background-color、background-image、background-repeat、background-position、background-attachment。
  5. 定位属性
    float、clear、position、top、right、bottom、left、min-width、min-height、max-width、max-height、overflow、clip、z-index。
  6. 生成内容属性
    content、counter-reset、counter-increment。
  7. 轮廓样式属性
    outline-style、outline-width、outline-color、outline。
  8. 页面样式属性
    size、page-break-before、page-break-after。
  9. 声音样式属性
    pause-before、pause-after、pause、cue-before、cue-after、cue、play-during。