View Full Version : XML Declaration Problem

01-14-2003, 01:18 AM
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?

<?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">

01-14-2003, 01:21 AM
Try styling the <html> element instead of <body> with CSS.

01-14-2003, 01:43 AM
thats what i was doing, thats where the question arose.

01-14-2003, 01:55 AM
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.

01-14-2003, 06:06 AM
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.

01-14-2003, 04:14 PM
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.

01-14-2003, 10:40 PM
*sigh* ill keep it out of my document then, until a solution arises.
thanks guys.

01-16-2003, 12:07 AM
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...).

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">
<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" />

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

01-16-2003, 01:43 PM
<p>When you put some text between your body tags, the page is valid. Don't know why.</p>

01-16-2003, 08:25 PM
oh yea i keep forgetting stuff like that, old coding habits :) thanks

01-28-2003, 06:53 PM
how 'bout if i combine the 2 elements in CSS?
body, html {}
would it translate okay? possible solution?

01-28-2003, 08:16 PM
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.

01-28-2003, 09:28 PM
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 ....