CSS对于网页制作而言就相当于房屋中装修的作用一样,能够熟练的使用CSS可以使我们制作出来的网页更加美观。
一.标签选择器
h1 {width:300px;height:100px;color:red; font-size:14px;}
二.ID选择器
#banner{width:950px;height:450px;border:1px solid red;color:red;}
<p id="red">这个段落是红色。</p>
<p id="green">这个段落是绿色。</p>
三.Class(类)选择器
.content{width:950px;height:450px;border:1px solid red;}
Class选择器于ID选择器的区别:Class选择器可以存在多次,重复使用,而ID不能。
选择器的分组选择
h1,h2,h3,h4,h5,h6 {
color : red;
}
注:表示h1到h6标签的颜色都是红色。
CSS注释
/* 注释内容 */
四.CSS几种链接链接样式
1.内嵌样式
<style type="text/css">
.top{width:985px;height:260px;background:#FFCC66;}
</style>
2.Link样式表式
<link rel=”stylesheet” type=”text/css” href=”my.css”>
3.Html式
<style type="text/css">@import url("css.css");></style>
4.行内样式
<div "color:red;font-size:12px;"></div>