How to align all columns using colgroup? Does it work with colspan?
Example
This HTML code was tested using Firefox and Chrome, but no browser displayed a center for all expected columns.
<table border="1" width="100%"> <colgroup> <col style="text-align:center;background-color:red"/> <col align="center" valign="bottom" style="background-color:blue"/> <col align="center" valign="top" style="background-color:yellow"/> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td align="center">$53</td> </tr> <tr> <td><big>5869207</big></td> <td>My first CSS</td> <td><small>$49</small></td> </tr> </table>
Use this example (copy / paste in) at w3schools.com/tags .
PS: What is wrong with the align and valign ? The style (text alignment) is also not responding.
EDIT
As I said above, I need a colgroup solution. It can also be " colgroup or col tags with the style attribute".
My template system should use colgroup (!), Is not a valid solution without colgroup . My system does not need HTML5 compatibility, it uses something like an "XHTML module" ( see DTD Example ).
Related Questions
- Is html <col align> deprecated? : not the same because my problem is with XHTML and not with HTML5 (this is not XML and is the "plan of the future standard").
Peter Krauss
source share