写在前面
- CSS样式命名规则
- CSS字体和文本样式
- 文字
- 文本
一、CSS样式命名规则
-
使用字母、数字、”-“ 和”_"
-
以小写字母开头
-
可以是单字,连字符,下划线或者是驼峰形式
-
语义化命名
例如:容器:container 导航:nav
二、CSS字体和文本样式
- 文字
- 字体:font-family
- 字体大小:font-size
- 绝对单位:in / cm / mm / pt / pc / xx-small / x-small / small / medium / large / x-large / xx-large
- 相对单位:像素 / em / 百分比
- 文字颜色:color:rgb() / 16进制 / 颜色名
- 文字粗细:font-weight:normal / bold / bolder / lighter / 100~900
- 斜体 : font-style:normal / italic / oblique
- 文字变形:font-variant:normal / small-caps
- 文本
- 水平对齐: text-align:设置元素内文本的水平对齐方式
- left / right / center / justify
- 行高: line-height
- 垂直对齐:vertical-align:设置元素内容的垂直方式
- baseline / sub /super / top / text-top / middle / bottom / text-bottom / 长度 / 百分比
- 首行缩进:text-indent
- word-spacing:设置元素内单词之间的间距,是以空格来分辨单词的
- letter-spacing:设置元素内字母之间的间距
- text-transform:设置元素内文本的大小写
- text-decoration:设置元素内文本的装饰
- underline:下划线
- overline:上划线
- line-through:贯穿线
- blink:闪烁线,有兼容性问题
- none:无效果,默认为none
- 水平对齐: text-align:设置元素内文本的水平对齐方式