html - 链接之间的制表符会导致 Chrome 中的伪元素出现问题

标签 html css google-chrome pseudo-element clearfix

在 Chrome 中,单击结果 Pane 并点击 Tab 以关注此处的第一个链接:

http://jsfiddle.net/2q6c7c36/2/

请注意 .box 的内容是如何“跳出”其边界的?它似乎是由我正在使用的 clearfix 类引起的。这是 Chrome 中的错误还是我做错了什么?我在为图标字体使用伪元素时也注意到了这一点。

谢谢。

.clearfix:after{
    content: ".";
    visibility: hidden;
    display: block;
    height: 0;
    clear: both;
}

最佳答案

演示 - http://jsfiddle.net/victor_007/2q6c7c36/3/

content:"." 设置为 content:""

.box {
  border: 2px solid black;
  border-radius: 10px;
  position: absolute;
  float: left;
  width: 318px;
  overflow: hidden;
}
.clearfix:after {
  content: "";
  visibility: hidden;
  display: block;
  height: 0;
  clear: both;
}
a {
  display: inline-block;
  background-color: #555;
  color: white;
  text-decoration: none;
  font-family: helvetica;
  padding: 3px;
}
<div class="box clearfix">
  <a href="#" class="button">Button</a>
  <a href="#" class="button">Button</a>
  <a href="#" class="button">Button</a>
</div>

关于html - 链接之间的制表符会导致 Chrome 中的伪元素出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26415250/

相关文章:

javascript - 计算十六进制颜色范围

css - 在 IE 9 中分析 css

php - 上传多个文件导致同一个文件上传4次

html - 如何在表格的单元格中添加多空格文本

php - 优点和缺点 : Writing HTML in PHP

javascript - 导入的 React 组件具有不需要的宽度 : 0 div at root and is stopping the component fill the parents CSS grid area

html - 为什么align-self是: stretch not working on a flex item?

javascript - 有没有办法请求 Chrome 扩展弹出窗口的麦克风访问权限?

javascript - 无法访问 webrtc 上的后置摄像头 [chrome :54]

reactjs - 访问本地主机上的 React 应用程序时,Testcafe 在 chrome 中运行测试时抛出错误