I am a bit puzzled right now, because I had CSS code that worked, but it wasn't beautiful at all. I now want to rework this CSS styles and build them via LESS. And I have big problems with display:table;
/ display:table-row;
and display:table-cell;
.
For example I have the following code: http://jsfiddle.net/La3kd/2/
How can I do it that the last cell (center) does not shift the above second cell to the right? The last cell should have the width of the 2 cells above. Some kind of colspan is needed. It is so weird, because I have the impression that it worked before I reworked the code. But now all elements to the right are totally shifted.
The colspan attribute in HTML specifies the number of columns a cell should span. It allows the single table cell to span the width of more than one cell or column.
The colspan attribute in HTML is used to set the number of columns a cell should span in a table. Use the colspan attribute on the <td> or <th> element.
The rowspan and colspan are <td> tag attributes. These are used to specify the number of rows or columns a cell should span. The rowspan attribute is for rows as well as the colspan attribute is for columns. These attributes have numeric values, for example, colspan=3 will span three columns.
The colspan attribute defines the number of columns a table cell should span.
CSS has no colspan
analog. Based on your example, you can just mark up your last row as a separate nontably block.
You could also use display: table-caption
in conjunction with caption-side: bottom
to display the table row as a last “row” that spans all columns. See live demo.
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