最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
CSS教程 16、CSS的伪元素Pseudo Elements [翻译
时间:2022-07-02 12:43:40 编辑:袖梨 来源:一聚教程网
伪元素吸附在选择上和pseudo classes伪类很像,像这样selector:pseudoelement{property: value;}。有四种方式。
First letters and First lines 首字母和首行
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)图片。
代码如下 | 复制代码 |
blockquote:before { content: open-quote; } blockquote:after { content: close-quote; } li:before { content: "POW: " } p:before { content: url(images/jam.jpg) } |
听起来不错吧,可惜大部分用户不能体会到before或after的效果,因为IE不支持。
相关文章
- 《弓箭传说2》新手玩法介绍 01-16
- 《地下城与勇士:起源》断桥烟雨多买多送活动内容一览 01-16
- 《差不多高手》醉拳龙技能特点分享 01-16
- 《鬼谷八荒》毕方尾羽解除限制道具推荐 01-16
- 《地下城与勇士:起源》阿拉德首次迎新春活动内容一览 01-16
- 《差不多高手》情圣技能特点分享 01-16