I have multiple spans within a div, with the wrapper displayed as a table and the spans displayed as table cell. Now I would like to have a header appear above the spans without having to nest the spans any further. Here is what I have:
.wrap {
width: 300px;
display: table;
}
.header {
display: table-header-group;
}
.first {
display: table-cell;
background: red;
padding: 10px;
}
.second {
display: table-cell;
background: green;
padding: 10px;
}
.third {
display: table-cell;
background: blue;
padding: 10px;
}
<div class="wrap">
<span class="header">Header</span>
<span class="first">First</span>
<span class="second">Second</span>
<span class="third">Third</span>
</div>
https://jsfiddle.net/kn8b20p3/
If you inspect the "header" it appears to fill the full 100% width but if there is more text or a background color it only expands over the first column.
Is there a way to make it cover all three columns like a real header without nesting the spans further?