我一直在寻找一对夫妇Twitter的引导模板,我看到了很多::before与::after之前和之后插入div标签.
谁能告诉我它们是什么?
我读过::before用于在你使用它的元素之前添加内容,例如
p::before {
content: "Read this: ";
}
Run Code Online (Sandbox Code Playgroud)
但是我见过的大部分时间(通过开发人员工具窥视网页)他们使用它们没有任何元素,例如
<div class="btn-toolbar" role="toolbar">
::before
<div class="btn-group">
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-align-left"></span></button>
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-align-center"></span></button>
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-align-right"></span></button>
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-align-justify"></span></button>
</div>
::after
</div>
Run Code Online (Sandbox Code Playgroud)
令人惊讶的是,当您查看网页源代码时,这些::before或::after元素不会显示.
为什么它们显示在开发人员工具中?