Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

<html> tag question...

  • 20-06-2006 11:53AM
    #1
    Registered Users, Registered Users 2 Posts: 3,594 ✭✭✭


    Can the <html> tag contain an attribute id ?

    Its a css related question ...

    I'm fully aware you can have the body tag contain an id ... but I'm just wondering if there are restrictions on doing it in the <html> tag as well as browser compatibility issues possibley or another reason ?

    Cheers,
    James


Comments

  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    validating a direct input of html into the w3c validator returned this message to me :)

    and this was using
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    Error Line 2 column 9: there is no attribute "ID".

    <html id="test">

    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

    This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

    How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.


  • Registered Users, Registered Users 2 Posts: 3,594 ✭✭✭forbairt


    Validating it isn't a problem ... as she's clean valid xhtml

    Mainly concerned that there is some reason not to do it ... I've only ever seen it done for body tags ...
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html id="so">
    


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    never come across id being used in the html tag - however some browsers might not like it


  • Registered Users, Registered Users 2 Posts: 3,594 ✭✭✭forbairt


    Friend came up with this link for me ..

    http://lists.w3.org/Archives/Public/www-archive/2003Mar/att-0105/table

    So its valid in some doctypes such as the one I was using .. :)

    Hmm... guess I'll just have to run it through the test suite later on and see how she copes :)

    thanks for the response


Advertisement