- 段落加入一个边框
p{border:1px solid red;}
- 注意
p span{color:purple;}
和p>span{color:purple;}
的区别 - 内联样式表(标签内部)> 嵌入样式表(当前文件中)> 外部样式表(外部文件中)。
- 内联式肯定是优先级最高。嵌入式和外联式取决于远近。注意后面2者的写法
<style type="text/css">
span{
color:red;
}
</style>
<link href="style.css" rel="stylesheet" type="text/css">
- 字体,字号,颜色
body{
font-family:"宋体";font-size:12px;color:#666
}
- 文字排版–粗体
span{font-weight:bold;}
- 文字排版–斜体
span{font-style:italic;}
- 文字排版–下划线
p{text-decoration:underline;}
- 文字排版–删除线
p{text-decoration:line-through;}
- 段落排版–缩进
p{text-indent2em}
- 段落排版–行间距(行高)
p{line-heigh:1.5em}
- 文字间隔或者字母间隔
h1{letter-spacing:50px}
- 英文单词之间的间距
h1{word-spacing:50px}
(letter的优先级更高)
10.段落排版–对齐 h1{text-align:center}
第十一章
- 盒模型
margin border padding width
- 水平居中设置-定宽块状元素 css中宽度和maigin的左右必须都设置