..

CSS 旧笔记拾遗

重新翻阅旧笔记,把比较有用的搬运过来。

数值

长度单位

数值继承

CSS 的长度单位有绝对长度与相对长度。当一个父元素使用相对长度时,子元素从父元素那里继承来的是 computed value 还是原始的 css rule?

<!-- pg-title: text-indent 的继承方式 -->
<h1>Some thing there...</h1>
body {
    font-size: 12px;
    text-indent: 3em;  /* computed value: 36px */
}

h1 {
    font-size: 24px
}

从上面的例子可以看出,是按 computed value 来继承。大部分 css 属性的基础方式都是 computed value 继承。

  • 布局
    • flex
    • grid
  • 定位
    • 相对定位
    • 绝对定位
    • fixed
    • sticky
  • 文本样式
    • basic: color/size/weight
    • font-family: font-family/font-face
  • 图片样式
    • src
    • repeat
    • position
  • background
    • 图片
    • 渐变
  • Table 样式
  • 动画