一:网页的结构
1 2 3
| 1.结构(html) 2.表现(css) 3.行为(javascript)
|
二:网页的表现
1 2
| css是用来装饰网页的,是层叠样式,其中我们的网页是立体的, 是一层一层的,只不过我们是俯视的,看到的是平面。
|
三:css的分类
3.1 内联样式
1 2
| 写在标签的样式,只对引入的标签有效,通过style进行修饰,如: <p style="color:red;font-size:20px;">我的祖国</p>
|
3.2 内部样式
1 2 3 4 5 6 7 8
| 写在head中的样式,可以对标签,class,id进行修饰,如: <style> p{ color:red; font-size:20px; } </style> 这是对本网页所有的p标签的文字显示红色,字体是20px;
|
3.3 外部样式
1 2 3 4
| 通过link引入外部的.css文件,实现对网页的装修。 如: <link ref="stylesheet" href="./index.css"> 其中index.css文件内容如下,对所有引入的此样式的网页生效。 开发基本使用此方式。
|
1 2 3 4
| p{ color:red; font-size:20px; }
|
四:优先级
1 2
| 内联样式 > 内部样式 > 外部样式,但是嵌入式>外部式有一个前提:嵌入式css样式的位置一定在外部式的后面, 针对外部样式和内部样式,对同一个标签或者class,谁后引入谁优先级最高。
|
*************感谢您的阅读*************