css3的学习
一、选择器
1、element>element 选择器
例如:div>p
选择父元素为 <div> 元素的所有 <p> 元素
2、element+element 选择器
例如:div+p
选择紧接在 <div> 元素之后的所有 <p> 元素
3、:first-of-type 选择器
例如:p:first-of-type
选择属于其父元素的首个 <p> 元素的每个 <p> 元素
4、:last-of-type 选择器
例如:p:last-of-type
选择属于其父元素的最后 <p> 元素的每个 <p> 元素
5、:only-of-type 选择器
例如:p:only-of-type
选择属于其父元素唯一的 <p> 元素的每个 <p> 元素
可出现其他元素,但p元素仅能出现一次
6、only-of-type 选择器
例如:p:only-of-type
选择属于其父元素唯一的 <p> 元素的每个 <p> 元素
父元素中不能有其他元素
7、:nth-child(n)选择器
比如:p:nth-child(2)
选择属于其父元素的第二个子元素的每个 <p> 元素
必须出现在第二位上。
8、nth-of-type(n)
比如:nth-of-type(2)
选择属于其父元素第二个 <p> 元素的每个 <p> 元素
不一定在第二个位置,但是必须要是第二次出现。
浏览器的兼容性问题
1、<--[if ie]>
只在ie浏览器生效
<![endif]-->
2、<--[if get ie6]>
只在以下版本生效
<![endif]-]>->
3、<--[if ie6]>
只在IE6下生效
<![endif]-->
4、<--[if ie6]>
只在IE6下生效
<![endif]-->
5、<--[if! ie]>
非Ie浏览器下生效
<![endif]-->
三、切图片
1、插入要切的图片
border-image-soure:url
2、要切多大的内容
border-image-slice
3、切下来的图片在网页中显示多大
border-image-width
一、选择器
1、element>element 选择器
例如:div>p
选择父元素为 <div> 元素的所有 <p> 元素
2、element+element 选择器
例如:div+p
选择紧接在 <div> 元素之后的所有 <p> 元素
3、:first-of-type 选择器
例如:p:first-of-type
选择属于其父元素的首个 <p> 元素的每个 <p> 元素
4、:last-of-type 选择器
例如:p:last-of-type
选择属于其父元素的最后 <p> 元素的每个 <p> 元素
5、:only-of-type 选择器
例如:p:only-of-type
选择属于其父元素唯一的 <p> 元素的每个 <p> 元素
可出现其他元素,但p元素仅能出现一次
6、only-of-type 选择器
例如:p:only-of-type
选择属于其父元素唯一的 <p> 元素的每个 <p> 元素
父元素中不能有其他元素
7、:nth-child(n)选择器
比如:p:nth-child(2)
选择属于其父元素的第二个子元素的每个 <p> 元素
必须出现在第二位上。
8、nth-of-type(n)
比如:nth-of-type(2)
选择属于其父元素第二个 <p> 元素的每个 <p> 元素
不一定在第二个位置,但是必须要是第二次出现。
浏览器的兼容性问题
1、<--[if ie]>
只在ie浏览器生效
<![endif]-->
2、<--[if get ie6]>
只在以下版本生效
<![endif]-]>->
3、<--[if ie6]>
只在IE6下生效
<![endif]-->
4、<--[if ie6]>
只在IE6下生效
<![endif]-->
5、<--[if! ie]>
非Ie浏览器下生效
<![endif]-->
三、切图片
1、插入要切的图片
border-image-soure:url
2、要切多大的内容
border-image-slice
3、切下来的图片在网页中显示多大
border-image-width