I'm trying to build a table with the display: table
attribute.
The problem I'm having is that I've got a structure where my Table contains different rows where each two rows should build a group of rows. Therefore I used table-row-group
<div class="table">
<div style="display: table-row-group;">
<div class="display: table-row;">
<div class="cell">
<p>18:00:00</p>
</div>
<div class="cell"></div>
<div class="cell right">
<p>A</p>
</div>
</div>
<div class="display: table-row;">
<div class="cell team">
<p>Team 1</p>
</div>
<div class="cell center">
<p>:</p>
</div>
<div class="cell right team">
<p>Team 2</p>
</div>
</div>
</div>
</div>
Here's the fiddle: http://jsfiddle.net/2xqfdn38/
What I want to do now, between each table-row-group should be a space but not between the table-rows. I tried to add a border-spacing to the class table, but this will result in a spacing between all rows and not only between the table-row-groups.
Does anybody knows a solution?
I think you should use border-collapse in table.
i hope it will helps you.
border-collapse:collapse;
The following changes in your css will add space between row groups.
.row-group::after
{
content: "\00a0";
}
I have also updated your fiddle
Another solution is:
.table {
font-size: 18px;
border-spacing: 0 10px;
display: table;
width: 100%;
border-collapse: collapse;/*Set border-collapse: collapse*/
}
.row-group {
display: table-row-group;
width: 100%;
border-bottom: 10px solid #ffffff;/*Change border color to white and apply only to bottom*/
}
And one better one is to use pseudo-element after
:
.row-group:after{
content: "";
height:20px;
display: block;
}
You can adjust height according your needs.
Remove the border spacing from table class, Then use a border the same colour as your page background to create a space between the groups, this css should work fine;
.row .cell {
border-bottom: 10px solid #fff; /* FOR A WHITE BACKGROUND */
}
.row.header .cell {
border: none !Important;
}
Demo here > http://jsfiddle.net/23of5xv8/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.