Reputation: 95
I'm trying to make a chessboard by using a table, and thus want to eliminate any padding between the td
elements:
However, they get a padding of 8px
, and the Developer Tools say that it's inherited from my class noPadding
:
That doesn't make any sense... How can I fix this?
Rest of the CSS
, in case it's relevant:
.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%;
}
<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>
Upvotes: 0
Views: 695
Reputation: 1620
Ensure the .noPadding
class overrides Bootstrap's '.table' class padding, defined for the table element.
I can't test your code but some of these CSS rules should work:
Simple:
.noPadding {
padding: 0 !important;
}
Or, avoiding the !important
directive:
.noPadding,
.table>thead>tr>th.noPadding,
.table>tbody>tr>td.noPadding,
{
padding: 0;
}
You may need to add more selectors to override the .table
class, as shown in your Imgur screenshot.
Upvotes: 1