一些重要的知识点:
标签选择器:即html/css中用到的一些标签如:<html><head><body><p><h1><img>
font-size:12px;字体大小
font-weight:normal/blod;粗体或者正常体
line-height:1.6em;行距
为表格加框:
<style type="text/css">
table tr th,td{
border:1px solid #000;
}
</style>
类选择器:
<style type="text/css">
.street{
color:red;
}
</style>
<span class="street">....</span>
.开头
即定义一个公共的类,下面使用时直接调用即可。
id选择器:
<style type="text/css">
#street{
color:red;
}
</style>
<span id="green">...</span>
#开头
两者区别:
类选择器可以在文档中多次使用,并且可以一次使用多个,id选择器(只能使用一次,并且一次使用一个)不可以。
子选择器:
即">"用于选择指定标签的第一代子元素。
包含(后代)选择器:
用" "作用于所有后代。
通用选择器:
* {}对所有元素起作用。
伪类选择符:
为什么叫做伪类选择符,它允许给html不存在的标签(标签的某种状态)设置样式,比如说我们给html中一个标签元素的鼠标滑过的状态来设置字体颜色:
a:hover{color:red;}
分组选择器:
first,second{color:green;}
相当于:
first{color:green;}
second{color:green;}
标签选择器:即html/css中用到的一些标签如:<html><head><body><p><h1><img>
font-size:12px;字体大小
font-weight:normal/blod;粗体或者正常体
line-height:1.6em;行距
为表格加框:
<style type="text/css">
table tr th,td{
border:1px solid #000;
}
</style>
类选择器:
<style type="text/css">
.street{
color:red;
}
</style>
<span class="street">....</span>
.开头
即定义一个公共的类,下面使用时直接调用即可。
id选择器:
<style type="text/css">
#street{
color:red;
}
</style>
<span id="green">...</span>
#开头
两者区别:
类选择器可以在文档中多次使用,并且可以一次使用多个,id选择器(只能使用一次,并且一次使用一个)不可以。
子选择器:
即">"用于选择指定标签的第一代子元素。
包含(后代)选择器:
用" "作用于所有后代。
通用选择器:
* {}对所有元素起作用。
伪类选择符:
为什么叫做伪类选择符,它允许给html不存在的标签(标签的某种状态)设置样式,比如说我们给html中一个标签元素的鼠标滑过的状态来设置字体颜色:
a:hover{color:red;}
分组选择器:
first,second{color:green;}
相当于:
first{color:green;}
second{color:green;}