首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >幽灵填充物出现在td中,尽管我去掉了填充。

幽灵填充物出现在td中,尽管我去掉了填充。
EN

Stack Overflow用户
提问于 2019-01-20 21:31:30
回答 1查看 621关注 0票数 0

我试图通过使用表来制作棋盘,因此希望消除td元素之间的任何填充:

然而,他们得到了一个填充的8px,开发工具说它是从我的类noPadding继承的

这没有任何意义..。我怎么才能解决这个问题?

CSS的其他部分,如果相关的话:

代码语言:javascript
复制
.noPadding {
  padding: 0px;
}

html {
  height: 100vh;
  width: 100%;
  margin: 0px;
}

body {
  height: 100%;
  height: 100%;
  margin: 0px;
}

.container-fluid {
  background-image: url(baggrunn.jpg);
  background-repeat: no-repeat;
  background-size: cover;
  height: 100%;
  width: 100%;
}

.thinBorder td,
.thinBorder th,
.thinBorder tr {
  border: solid #000 1px;
  padding: 0;
  margin: 0;
}

.borderless td,
.borderless th,
.borderless tr {
  border: none;
  padding: 0;
  margin: 0;
}

.noBordersBruh table td,
.noBordersBruh th {
  display: block;
  border-collapse: collapse;
  border-spacing: 0;
  box-sizing: border-box;
}

.top20 {
  padding-top: 15px;
  width: 100%;
  font-size: 20px;
  font-weight: bold;
}

.glyphicon {
  font-size: 20px;
}

.noPadding {
  padding: 0px;
}

.noMargin {
  margin: 0px;
}

.herregudbredde {
  width: 12.5%;
}

.fullBredde {
  width: 100%;
}
代码语言:javascript
复制
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table borderless noBordersBruh col-md-12" cellspacing="0" cellpadding="0">
  <tbody>
    <tr>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt1.png" alt="A8"></td>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt2.png" alt="B8"></td>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt1.png" alt="C8"></td>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt2.png" alt="D8"></td>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt1.png" alt="E8"></td>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt2.png" alt="F8"></td>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt1.png" alt="G8"></td>
      <td class="noPadding"><img class="img-responsive fullBredde borderless noBordersBruh" src="Content/ikonene/felt2.png" alt="H8"></td>
    </tr>

  </tbody>
</table>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-21 02:35:49

确保.noPadding类覆盖为表元素定义的引导带的'.table‘类填充。

我无法测试您的代码,但是其中一些CSS规则应该可以工作:

简单:

代码语言:javascript
复制
.noPadding {
    padding: 0 !important;
}

或者,避免!important指令:

代码语言:javascript
复制
.noPadding,
.table>thead>tr>th.noPadding,
.table>tbody>tr>td.noPadding,
{
    padding: 0;
}

您可能需要添加更多的选择器来覆盖.table类,如Imgur屏幕截图所示。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54281186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档