HTML 5 Validation

HTML 5 Validation

MorgMorg Posts: 7Questions: 0Answers: 0
edited August 2011 in Feature requests
Hello,

I just tried validating a page in which I use DataTables (god bless you, at least this tool is (totally) usable without a complete rewrite ;) ).

Small details anyway, here's the output I got from W3C Validator - Are you planning on changing this or is it for backwards compatibility ?

Validation Output: 3 Errors

Error Line 44, Column 83: The cellpadding attribute on the table element is obsolete. Use CSS instead.




Error Line 44, Column 83: The cellspacing attribute on the table element is obsolete. Use CSS instead.




Error Line 44, Column 83: The value of the border attribute on the table element must be either 1 or the empty string. To regulate the thickness of table borders, Use CSS instead.



Again . much thanks, feels great not to have to code everything from scratch to get it done right ;)

Replies

  • MorgMorg Posts: 7Questions: 0Answers: 0
    edited August 2011
    Slight Update : this was mostly due to copy/pasting from the original example, it "looks" like this CSS can replace the old tags and keep it all HTML5 validated :

    table {
    border-collapse: collapse;
    }

    Could you confirm this is a valid solution (and not just a dirty hack) ?

    Thanks.
  • allanallan Posts: 57,263Questions: 1Answers: 9,121 Site admin
    The examples are all HTML 4 strict, so if you want to use them in a valid HTML 5 context you need to modify them slightly - has you have seen. This is simply a matter of stripping out the old attributes.

    And generally yes border-collapse will do. However cell padding is done with table td { padding: ... }. there are probably other options as well, but those will be the two main ones :-)

    Allan
  • MorgMorg Posts: 7Questions: 0Answers: 0
    Thanks Allan, here is the summary of changes I made to have my datatables page html5 compliant :

    -> removal of old attributes (padding/spacing/border)
    -> added border-collapse:collapse; to the table styles (padding / border 0 equals to not setting them in my case)
    -> added title on the table (useless but ... compliance ...)
This discussion has been closed.