相关疑难解决方法(0)

::之前和::之后做什么意思?

我一直在寻找一对夫妇Twitter的引导模板,我看到了很多::before::after之前和之后插入div标签.

谁能告诉我它们是什么?

html css

13
推荐指数
2
解决办法
1万
查看次数

什么是:: before或:: after表达式,为什么它显示在浏览器开发人员工具中?

我读过::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元素不会显示.

为什么它们显示在开发人员工具中?

html css pseudo-element

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

标签 统计

css ×2

html ×2

pseudo-element ×1