小编Bla*_* M.的帖子

多个:在css中的伪元素之前或:之后

让我们说我有一个包含通知消息的div

<div class="notification"></div>
Run Code Online (Sandbox Code Playgroud)

消息是通过PHP动态生成的

<div class="notification><?php echo $notif;?></div>
Run Code Online (Sandbox Code Playgroud)

但我希望那个div说它持有通知

Notification: [notification message]
Run Code Online (Sandbox Code Playgroud)

所以我输入了css:

.notification:before{
    content:'Notification: ';
}
Run Code Online (Sandbox Code Playgroud)

问题是我可以为该div添加另一个内容.例如,我想在通知之前出现警告图片:

所以可以把另一个和之前

.notification:before{
     content:url(warning.png);
}
Run Code Online (Sandbox Code Playgroud)

如果我喜欢那最后一个来了.那么如何展示它们呢?

html css

1
推荐指数
1
解决办法
2213
查看次数

标签 统计

css ×1

html ×1