写在前面
- 整理一下平时所学+所用到的 CSS 基本语法
CSS 基本语法
CSS2.1 语法
CSS2.1 总体结构
- 简化为:
- @charset
- @import
- rules
- @media
- @page
- rule
CSS @ Rules
CSS Qualified Rule 的结构
- Selector
- Key
- Properties
- Variables
- Value
- css-values-4
- CSS 属性值可能是以下类型。
- CSS 范围的关键字:initial,unset,inherit,任何属性都可以的关键字。
- 字符串:比如 content 属性。
- URL:使用 url() 函数的 URL 值。
- 整数 / 实数:比如 flex 属性。
- 维度:单位的整数 / 实数,比如 width 属性。
- 百分比:大部分维度都支持。
- 颜色:比如 background-color 属性。
- 图片:比如 background-image 属性。
- 2D 位置:比如 background-position 属性。
- 函数:来自函数的值,比如 transform 属性。
- calc()
- max()
- min()
- clamp()
- toggle()
- attr()
初建 CSS 知识体系
收集标准
- all standards and drafts are in the id named container of the html document.
- so we can write a script to collect the standards.
第一步:获取所有 li dom 节点
1 | const list = document.getElementById("container").children |
第二步:匹配出 data-tag 中为 css 的 standard
观察得到,我们只需要将 data-tag nodeValue 中有 “css” 抓出来即可
1
2
3
4
5
6
7
8
9
10
11const list = document.getElementById("container").children
const result = []
for (let i of list) {
if (i.getAttribute('data-tag').match(/css/)) {
result.push({
name: i.children[1].innerText,
url: i.children[1].children[0].href
})
}
}
console.log(JSON.stringify(result, null, ' '))
收集 CSS 属性相关标准
1 | let iframe = document.createElement("iframe"); |
写在后面
- 祝大家多多发财