Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XML Declaration Problem

    we all know that an xml document needs a root element, in xhtml this is <html>
    however i am running into some CSS problems, mainly in the overflow attrib. (as far as i can see)
    when i add the xml declaration, my html element looses the css configurations, is it the conflicting versions bitween the xhtml dtd and the xml? what could be causing this?
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    ......
    </html>

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Try styling the <html> element instead of <body> with CSS.

  • #3
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thats what i was doing, thats where the question arose.
    Last edited by cg9com; 01-14-2003 at 01:45 AM.

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Which browser? What is the document being served as?

    If IE sees that <?xml?> processing instruction, it gets all confused and puts itself into quirks mode.

  • #5
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i was testing in IE6
    all styling to the <html> element stops when the xml declaration is added.
    i know its not even required in a xhtml document, but i was putting it there for a reason.

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's the whole rub of it - if the first thing on the page is <?xml?> then IE6 goes into quirks mode, so the BODY represents the entire canvas; whereas Gecko, in that same situation, goes into Standards mode, where HTML represents the entire canvas.

    As far as I know, there's no direct solution for this.

  • #7
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts

    *sigh* ill keep it out of my document then, until a solution arises.
    thanks guys.

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #8
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    being stubborn ive been constantly trying to work with the w3 validator in getting this to work, no sucess but after messing around a bit, it keeps returning an error to me now that was never there before.
    Line 14, column 6: end tag for "body" which is not finished (explain...).
    </body>
    i stripped it down and this is literally all i have in my document, and its still returning the error, why?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <title>cg9com</title>
    <link rel="stylesheet" type="text/css" href="cg9com.css" />
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <meta name="author" content="cg9com" />
    </head>
    <body>
    </body>
    </html>

    maybe in editing i got rid of something? i dont see anything though.
    also is specifying a charset iso important?

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <body>
    <p>When you put some text between your body tags, the page is valid. Don't know why.</p>
    </body>

  • #10
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh yea i keep forgetting stuff like that, old coding habits thanks

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #11
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how 'bout if i combine the 2 elements in CSS?
    body, html {}
    would it translate okay? possible solution?

  • #12
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Yes. Be careful with applying margins, padding, and borders with that though, as it will apply twice (once to html, and once to body) to any correct browser.

  • #13
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is it still correct CSS?
    if overflow:hidden; goes in the html, and i add "html, body" it would apply to the body as well, but it doesnt go in the body, the only time that it would apply there is in IE quirks ....


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •