1.属性
分类 |
属性 |
内容 |
示例 |
备注 |
重复 |
背景 |
background-color |
背景色 |
background-color: gray ; | ||
padding |
背景色向外延伸 |
padding: 20px ; |
2 | ||
background-image |
背景图片 |
background-image: url(bk.jpg) ; | |||
background-repeat |
平铺 |
background-repeat: no-repeat ; | |||
background-position |
位置 |
background-position: left top ; |
2个值left top 用空格分开, % , 100px, | ||
background-attachment |
滚动 |
background-attachment: fixed ; | |||
文本 |
text-indent |
第一行缩进 |
text-indent: 4em ; |
可以是 %, 相对于父元素的% | |
text-align |
文本对齐方式 |
text-align: center ; |
2 | ||
word-spacing |
单词之间的间隔 |
word-spacing: 30px ; | |||
letter-spacing |
字母之间的间隔 |
letter-spacing: 10px ; | |||
text-transform |
字符转换 |
text-transform: uppercase ; |
uppercase大写,lowercase小写,capitalize首字母大写,none没转换 | ||
text-decoration |
文本装饰 |
text-decoration: underline ; |
none,underline,overline,line-through | ||
字体 |
font-family |
通用字体系列 |
font-family: sans-serif; |
特定和通用结合 font-family: sans-serif, serif ; | |
font-style |
字体风格 |
font-style:italic ; | |||
font-variant |
小型大写字母 |
font-variant:small-caps ; | |||
font-weight |
字体加粗 |
font-weight: bold ; | |||
font-size |
字体大小 |
font-size: 40em ; |
推荐使用em单位 | ||
列表 |
list-styly-type |
列表前边小项式样 |
list-style-type: square ; |
ul li { list-style-image: url(xxx.gif)} | |
表格 |
border |
表格边框 |
border: 1px solid blue ; | ||
width |
表格宽度 |
width: 50px ; | |||
height |
表格高度 |
height: 50px ; | |||
vertical-align |
垂直对齐方式 |
vertiacal-align: bottom ; | |||
text-align |
水平对齐方式 |
text-align: center ; |
2 | ||
padding |
表格边框到内容的距离 |
padding: 15px ; |
2 | ||
background-color |
背景颜色 |
background-color: black ; |
2 | ||
color |
字体颜色 |
color: white ; |