admin 发表于 2024-5-25 18:06:11

CSS :before 选择器

在每个 <p> 元素的内容之前插入新内容:
<!DOCTYPE html>
<html>
<head>
<style>
p:before
{
content:"台词:";
}
</style>
</head>

<body>

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

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

</body>
</html>
运行效果如下:


页: [1]
查看完整版本: CSS :before 选择器