Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

<html> tag question...

Options
  • 20-06-2006 11:53am
    #1
    Registered Users 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 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 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