:after
定义和用法
:after 选择器在被选元素的内容后面插入内容,也可以在被选择元素后面添加新的样式。
如:
<body>
<h1>this is a test</h1>
<p>123</p>
</body>
用:after 设置样式,如下:
p:after{
content:"-添加的内容";
color:red;
fontsize:16px;
}
则显示后效果为:
123
-添加的内容
:after
<body>
<h1>this is a test</h1>
<p>123</p>
</body>
p:after{
content:"-添加的内容";
color:red;
fontsize:16px;
}