css标签选取属性
2016-08-16 10:24
239 查看
:first-child(首个子对象)
p:first-child {font-weight: bold;}
li:first-child {text-transform:uppercase;}
p:nth-child(2)
在下面的例子中,选择器匹配所有
元素中的第一个 元素:
p > i:first-child {
font-weight:bold;
}
在下面的例子中,选择器匹配所有作为元素的第一个子元素的
元素中的所有 元素:
p:first-child i {
color:blue;
}
“first-line” 伪元素用于向文本的首行设置特殊样式。
在下面的例子中,浏览器会根据 “first-line” 伪元素中的样式对 p 元素的第一行文本进行格式化:
p:first-line
{
color:#ff0000;
font-variant:small-caps;
}
:first-letter 伪元素
“first-letter” 伪元素用于向文本的首字母设置特殊样式:
p:first-letter
{
color:#ff0000;
font-size:xx-large;
}
CSS2 - :before 伪元素
“:before” 伪元素可以在元素的内容前面插入新内容。
下面的例子在每个
元素前面插入一幅图片:
元素后面插入一幅图片:
规定属于其父元素的第二个子元素的每个 p 的背景色:
p:nth-child(2)
{
background:#ff0000;
}
transition: 0.5s all ease;
-webkit-transition: 0.5s all ease;
-moz-transition: 0.5s all ease;
-o-transition: 0.5s all ease;
-ms-transition: 0.5s all ease;
body a {
transition: all 0.5s ease 0s;
}
背景颜色渐变
li:last-child{background:none;}…
prev
next
p:first-child {font-weight: bold;}
li:first-child {text-transform:uppercase;}
p:nth-child(2)
在下面的例子中,选择器匹配所有
元素中的第一个 元素:
p > i:first-child {
font-weight:bold;
}
在下面的例子中,选择器匹配所有作为元素的第一个子元素的
元素中的所有 元素:
p:first-child i {
color:blue;
}
“first-line” 伪元素用于向文本的首行设置特殊样式。
在下面的例子中,浏览器会根据 “first-line” 伪元素中的样式对 p 元素的第一行文本进行格式化:
p:first-line
{
color:#ff0000;
font-variant:small-caps;
}
:first-letter 伪元素
“first-letter” 伪元素用于向文本的首字母设置特殊样式:
p:first-letter
{
color:#ff0000;
font-size:xx-large;
}
CSS2 - :before 伪元素
“:before” 伪元素可以在元素的内容前面插入新内容。
下面的例子在每个
元素前面插入一幅图片:
h1:before
{
content:url(logo.gif);
}
CSS2 - :after 伪元素
“:after” 伪元素可以在元素的内容之后插入新内容。
下面的例子在每个
元素后面插入一幅图片:
h1:after
{
content:url(logo.gif);
}
规定属于其父元素的第二个子元素的每个 p 的背景色:p:nth-child(2)
{
background:#ff0000;
}
transition: 0.5s all ease;
-webkit-transition: 0.5s all ease;
-moz-transition: 0.5s all ease;
-o-transition: 0.5s all ease;
-ms-transition: 0.5s all ease;
body a {
transition: all 0.5s ease 0s;
}
背景颜色渐变
li:last-child{background:none;}…
prev
next
相关文章推荐
- Css + div 常用CSS标签及属性
- 标签增加CSS的overflow属性来清除浮动
- HTML和CSS的那些事儿-1标签属性和元素
- CSS和JS标签style属性对照表(方便js开发的朋友)
- CSS和JS标签style属性对照表
- CSS 标签属性
- 【转】CSS 和 JavaScript 标签 style 属性对照表
- CSS笔记-除了a标签外的hover属性的应用
- CSS 标签属性/属性参考
- CSS和JS标签style属性对照表
- CSS和JavaScript标签style属性对照表
- DIV 标签很重要的CSS的float属性
- 常用的CSS标签标记属性翻译注释
- JS中的CSS Style属性标签对照表
- CSS和JS标签style属性对照表
- 用CSS设置的border属性及标签不显示下划线
- CSS和JavaScript标签style属性对照表
- css 定义 html 页标签 没有的属性 超级好用 看了你就会明白了
- CSS和JS标签style属性对照表
- html css 超链接 A、Span 标签的width属性无效