CSS的At-Rules@规则

0
  伪元素吸附在选择上和pseudo classes伪类很像,像这样selector:pseudoelement{property: value;}。有四种方式。

First letters and First lines 首字母和首行

Example Source Code

first-letter伪元素作用到元素的第一个字母,first-line作用到元素的顶行。你可以,例如为段落创建一个drop caps和首行加粗。

 

p:first-letter {
font-size: 3em;
float: left;
}

p:first-line {
font-weight: bold;
}

Before and after 前后

before和after用来联系content属性不使用HTML确定一个元素的内容位置。
content属性值可以是:open-quote,close-quote,no-open-quote,no-close-quote,在引号标记里关闭任何字符串或使用url(imagename)图片。

 

 Example Source Code

blockquote:before {
content: open-quote;
}
blockquote:after {
content: close-quote;
}
li:before {
content: “POW: ”
}
p:before {
content: url(images/jam.jpg)
}

  听起来不错吧,可惜大部分用户不能体会到before或after的效果,因为IE不支持。

发表评论

您的邮箱不会公开,当您的评论有新的回复时,会通过您填写的邮箱向您发送评论内容。 必填字段 *

为何看不到我发布的评论?

正在提交, 请稍候...