tags:

views:

31

answers:

1

When I tried to convert my website to xhtml, things went perfectly until I realized that IE doesn't support it.

I went to the xhtml FAQ's section about IE, and tried out the workaround there, using an identity transformation to trick IE into rendering it as html in quirks mode. Unfortunately, this seems to make firefox (and possibly other browsers?) display the css background only over the text of the page.

So here is the code:

test.xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="copy.xsl"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
    <head>
        <link rel="stylesheet" type="text/css" href="backgroundexample.css" />
    </head>
    <body>
        <h1>This is a heading.</h1>
        <p>This is a paragraph.</p>
    </body>
</html>



backgroundexample.css:

body {
    background-color:red;
}



copy.xsl:

<stylesheet version="1.0"
     xmlns="http://www.w3.org/1999/XSL/Transform"&gt;
    <template match="/">
        <copy-of select="."/>
    </template>
</stylesheet>



The effect of this is that the background only displays over the text, not the whole page.

I could not find the problem here or by googling, so please tell me if this has already been asked (and i am therefore bad at searching).

+1  A: 

Can't verify your problem. Did you have tried something like this?

html, body {
    background-color:red;
}
gearsdigital
thank you! what is the significance of html rather than body?
Professor_Calculus
You're welcome. There is no significance between html and body. Both are elements you can style with css.To find out why your CSS does not work I would need some more informations like Browserversion, Operatingssystem. I assume that the `<?xml -tags` are the problem.But if it works right now...
gearsdigital
My css actually does work, though not in the way i expected: when styling html with a different style than body, the background is different from the "box" around the text. if html means the whole page and body means just the content, then this makes sense.
Professor_Calculus