Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

table-cell - some kind of colspan?

Tags:

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.

like image 272
Torben Avatar asked Mar 24 '12 12:03

Torben


People also ask

What is Colspan example?

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.

How do you add Colspan to a table?

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.

What is Rowspan and Colspan in table tag?

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.

What is Colspan in table?

The colspan attribute defines the number of columns a table cell should span.


1 Answers

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.

like image 180
Marat Tanalin Avatar answered Oct 28 '22 22:10

Marat Tanalin