<style type="text/css">
p::before{
content: "今天";
width: 100px;
height: 100px;
display: block;
background: red;
}
p::after{
content:"星期日";
width: 100px;
height: 100px;
background: red;
display: block;
}
</style>
</head>
<body>
<p>是</p>
</body>before和after的使用
最新推荐文章于 2024-07-16 05:22:28 发布
本文通过一个简单的例子展示了如何使用CSS的:before和:after伪元素来添加内容并设置样式。具体包括定义两个伪元素的内容、尺寸及背景颜色。
358

被折叠的 条评论
为什么被折叠?



