码迷,mamicode.com
首页 > 其他好文 > 详细

伪元素选择器

时间:2018-06-30 11:05:56      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:内容   fir   插入   string   span   size   prope   首字母   pre   

伪元素

介绍常用的伪元素。

first-letter

用于为文本的首字母设置特殊样式。

例如:

p:first-letter {
  font-size: 48px;
}

before

用于在元素的内容前面插入新内容。

例如:

p:before {
  content: "*";
  color: red;
}

在所有p标签的内容前面加上一个红色的*

after

用于在元素的内容后面插入新内容。

例如:

p:after {
  content: "?";
  color: red;
}

在所有p标签的内容后面加上一个蓝色的?

伪元素选择器

标签:内容   fir   插入   string   span   size   prope   首字母   pre   

原文地址:https://www.cnblogs.com/fmgao-technology/p/9246038.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!