HTML: Table - Merge Cells
Question by MyDVDs | 2012-08-15 at 18:47
I have a table with 2 rows and 2 columns, a total of 4 cells:
<table> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> <tr> <td>Cell 3</td> <td>Cell 4</td> </tr> </table>
Now, I want to connect the two upper cells (that is Cell 1 and Cell 2), because there will be a long sentence over the entire width of the table. Is this possible somehow?
Related Topics
MySQL: Delete Data from Table - Difference between TRUNCATE, DELETE and DROP
Tutorial | 0 Comments
SQLite: Check whether Table exists
Info | 0 Comments
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
CSS: Colorize Table Rows Alternately only with CSS
Tutorial | 0 Comments
MySQL: 3 Ways of showing Table Definition and Structure
Info | 0 Comments
MySQL: Add new Column to a Table
Tutorial | 0 Comments
PHP: Sending an E-Mail
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
The magic word is colspan. With colspan, you define the number of cells through which a cell should be extended in the right.
In your example that would be:
With this, Cell 1 and Cell 2 are connected to a long cell over two cells.
If you want to join cells under each other together, it works with rowspan. Simply paste it into the first cell like it is also feasible in the example above.
Last update on 2020-09-03 | Created on 2012-08-18