Jump to content

Colgroup & Doctype


JTeagle

Recommended Posts

Unless I'm reading it wrong, according to the page for the COLGROUP tag, it should be supported for Strict or Transitional. On its own it works as expected, but as soon as I put a DOCTYPE tag in the document, COLGROUP stops working - it has no effect. I've tried it in both IE and Chrome, so we can't blame IE for this one. If you take the Try It Yourself feature for COLGROUP, try adding a DOCTYPE declaration at the top - suddenly the columns no longer align as they should. What's happening here?

Link to comment
Share on other sites

what does your code look like? It does seem like it's applicable only to certain situations and under specific circumstances given particular browsers. Chrome (and Safari) only support span and width.

Link to comment
Share on other sites

what does your code look like? It does seem like it's applicable only to certain situations and under specific circumstances given particular browsers. Chrome (and Safari) only support span and width.
Literally, just <colgroup align="left"></colgroup><colgroup align="right"></colgroup>To see it go wrong: 1. Go to the page for COLGROUP: http://w3schools.com/tags/tag_colgroup.asp2. Use the Try It Yourself section to get the sample up and running. Confirm that it does align as expected. 3. Now paste in a DOCTYPE declaration at the top of their sample and refresh the result. The columns revert to left aligned (table body) / centred (table headers).The colour of the third column defaults to black as well - it's completely ignoring the <colgroup> tag, apparently. But the page for COLGROUP states that there are no differences between HTML and XHTML, and indicates that it is supported for any DTD. (OK, Chrome doesn't support align, but IE should - and both should support the style attribute in the Try It Yourself sample, and so the col should be blue unless overridden by the cell contents, of course, which they're not in the sample)I realise I can use CSS on the individual cells instead, but I'm looking for clarification of the colgroup tag since I happened to try it first.
Link to comment
Share on other sites

you shouldn't need to close it with </colgroup>try just <colgroup align="left" />However, align is deprecated in XHTML, which means it won't work if you add an XHTML DOCTYPE and colgroup isn't supported at all in Firefox, so you're screwed really

Link to comment
Share on other sites

you shouldn't need to close it with </colgroup>try just <colgroup align="left" />However, align is deprecated in XHTML, which means it won't work if you add an XHTML DOCTYPE and colgroup isn't supported at all in Firefox, so you're screwed really
According to the docs on this site it has the closing tag... can you always replace the closing tag for an element with the trailing / in the opening tag (if the element has no body text, of course)?Don't worry, I originally tried using a style sheet and a class for the colgroup as the docs suggested - that was when I first noticed it wasn't working. I resorted to the align attribute because I thought I'd done something wrong with the style sheet. And the docs say that Firefox is supported, although only span and width. So are the docs on here wrong? If so, why are they still showing the wrong info?
Link to comment
Share on other sites

It is my understanding that none of the Mozilla based browsers have implemented support for the colgroup element, therefore, it is unfortunately not worth using unless your target audience do not use Mozilla.Dor, you are right, the align attribute will 'work', but it your document will not validate and that is enough to switch browsers in to quirks mode

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...