Forum Moderators: not2easy

Message Too Old, No Replies

background images xhtml served as application/xhtml+xml

images not repeating

         

PHP_Chimp

6:24 pm on Jan 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have been changing over to sending application/xhtml+xml mime types for my xhtml pages...however FF is no longer repeating the background-image that is set for the body.
To keep the code small this is the bit -

body {
background-image:url(../images/bg_body.jpg);
background-repeat:repeat-x;

The CSS and XHTML all validate, IE displays it fine.
Seeing as IE works and FF doesnt I am assuming that I have done something that is wrong standards wise ;)
If someone could enlighten me.

The top of the xhtml is -

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="http://example.com/NEW/script/css.css" type="text/css"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb">
<head>

There may be a validation issue, as I use the HTTP_ACCEPT header to either send application/xhtml+xml to those that accept it. The W3C site either doesnt send that header or doesnt accept that mime type, so it gets the same files but served as text/html. Although I have validated both by direct input, so they should be ok.

encyclo

7:26 pm on Jan 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this:

[b]html[/b] {
background-image:url(../images/bg_body.jpg);
background-repeat:repeat-x;
}

(The

body
element is handled differently in XHTML.)

PHP_Chimp

7:33 pm on Jan 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



lol I was just about to ask about that. As I had been searching for that answer.

<edit>
Yep and it works with both IE and FF.

Is there any reason that xml treats the body as something separate? As surely it is just another tag?

<another edit>
To save on a new post -

Thanks for that encyclo :)

[edited by: PHP_Chimp at 8:10 pm (utc) on Jan. 30, 2008]

encyclo

7:44 pm on Jan 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In XML, you're right:
body
is "just another tag". In HTML however,
body
is more than that: the browsers take it as filling the browser window - so the outcome is different between the two rendering modes. So
body
is more like
html
when no styles are applied to
html
itself when the mime type is
text/html
. :)