常见的伪元素

一,伪元素

介绍常用的伪元素。

二,first-letter

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

例如:

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

三,berore

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

例如;

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

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

四,after

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

例如:

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

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

原文地址:https://www.cnblogs.com/xiaolang666/p/14686237.html