This is the desired effect:
And this is what I came up with: http://jsfiddle.net/nunoarruda/3j6782js/
// table
.sw-table {
border-collapse: separate;
thead {
background-color: $orange;
color: $white;
font-size: 15px;
th {
border: none !important;
font-weight: 600;
padding-top: 5px !important;
padding-bottom: 5px !important;
margin: 30px 27px !important;
&:first-child {
border-top-left-radius: 10px;
padding-left: 25px;
}
&:last-child {
border-top-right-radius: 10px;
}
}
}
tbody {
color: $black;
tr {
td {
border-color: $greyish;
padding-top: 10px !important;
padding-bottom: 10px !important;
}
td:first-child {
border-left: 1px solid $greyish;
padding-left: 25px;
}
td:last-child {
border-right: 1px solid $greyish;
}
&:first-child td {
border-top: none;
}
&:last-child td {
border-bottom: 1px solid $greyish;
&:first-child {
border-bottom-left-radius: 10px;
}
&:last-child {
border-bottom-right-radius: 10px;
}
}
}
}
}
It's just missing the space between the table row and the table border. I've tried using margin, padding, border, border-collapse but I couldn't achieve the desired effect. Any ideias?
The space between two rows in a table can be done using CSS border-spacing and border-collapse property. The border-spacing property is used to set the spaces between cells of a table and border-collapse property is used to specify whether the border of table is collapse or not.
HTML Table - Cell Padding. Cell padding is the space between the cell edges and the cell content.
The HTML <table> cellspacing Attribute is used to specify the space between the cells. The cellspacing attribute is set in terms of pixels. Attribute Values: pixels: It sets the space between the cells in terms of pixels.
The border-spacing CSS property sets the distance between the borders of adjacent cells in a <table> . This property applies only when border-collapse is separate .
Margin provides the space between the border and outer elements.
Check this fiddle:
The most important thing I did was wrap the first and last items in divs and styled them:
<td>
<div>Brand name</div>
</td>
This allowed me to take off the padding/border of the td and move it to the divs:
td:first-child {
border-left: 1px solid $greyish;
padding-left: 25px;
padding-top: 0;
padding-right: 0;
border-top: none;
div {
border-top: 1px solid $greyish;
padding-top: 10px;
padding-right: 8px;
}
}
The last thing I did was remove !important on the padding because that was messing with the new code. The borders are now attached to the divs inside first and last child instead of the tds!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With