in HTML tables, Is it possible to have multiple columns within one heading?

For example | Main Heading | | link | something | bla | | bla | 12 | bla |

Public Comments

  1. Yes. To do this, you need to use the colspan attribute. Here's the code for your example: <table border="1"> <tr><td colspan="3">Main Heading</td></tr> <tr><td>link</td> <td>something</td> <td>bla</td></tr> <tr><td>bla</td> <td>12</td> <td>bla</td></tr> </table> I set the table's border="1" so you can see the multiple columns in effect.
  2. yes,there is head tag in table <table> <tr> <th colspan=3>heading</th> </tr> <tr><td></td><td></td><td></td> </tr> .... . . . </table>
  3. Oh this late in the year of 2008, yes, we have the technology. : ) Assuming this is what you want... (taking it from the top) <html> <head><title>EZ</title></head> <body> <table> <tr><th colspan="3">Main heading</th></tr> <tr><td rowspan="2">link</td><td>something</td><td>bla</td></tr> <tr><td>12</td><td>bla</td></tr> </table> </body> </html> The colspan="3" obviously does the magic there, it tells the browser to 'span' the three td's directly below it, as well as the next three, etc. You'll noticed I changed it slightly to add that rowspan to show you how it works vertically. So the browser, reading your HTML and encountering these tags in the same order that they are in the file, laying out the table from top to bottom, then left to right, sees these tds and ths and says, ok, this will span 2 of these, this will span 3 of these.. etc. You can use this to make pretty sophisticated layouts, etc. But dude, tables are going the way of the dinosaur and you should really start learning CSS especially since supporting some of these newer browsers will be easier with CSS.
Powered by Yahoo! Answers