现在的位置: 首页 > 综合 > 正文

Css选择器!

2014年01月24日 ⁄ 综合 ⁄ 共 483字 ⁄ 字号 评论关闭

总的来说Css总共有这几大类! 

(1)标记选择器   
<style>
h1
{
color:red;
font-size:25px;
}
<style>

主要用于 HTML现有的标记,例如:<P>,<H1>,<H2>......

(2)类别选择器

<style>
<!--
.one
{
color:red;
font-size:25px;
}
.two
{
color:red;
font-size:25px;
}
-->
<style>

 

//标记 类别选择器

<style>
<!--
h3.one
{
color:red;
font-size:25px;
}
-->

<style>

 标记选择器大部时间满足不了用户的要求,由此引入类别选择器,使用也很简单。

<p class="one">于金生</p>
(3)ID选择器(不能重复使用)
<style>
<!--
#one
{
color:red;
font-size:25px;
}
#two
{
color:red;
font-size:25px;
}
-->

<style>
使用方法:
<p id="one">于金生</p>
错误的使用方法
<p id="one two">于金生</p>

 

选择器可以嵌套使用,。。。

抱歉!评论已关闭.