css :before :after

来源:互联网 发布:老男孩网络班 编辑:程序博客网 时间:2024/05/21 06:33

p:before是在p标签里面的前部分,after是在p标签里面的后部分


<!DOCTYPE html>

<html>
<head>
<style>
p:before
{
content:"前面:";
background-color: #FF0000;
}
p:after
{
content:"后面:";
background-color: #0000FF;
}
p {
background-color: #00FFFF;
}
</style>
</head>


<body>


<p>我是唐老鸭。</p>
<p>我住在 Duckburg。</p>


<p><b>注释:</b>对于在 IE8 中工作的 :before,必须声明 DOCTYPE。</p>


</body>
</html>
0 0