Cannot set background color (XML+CSS)

  • Thread starter michael_quinlivan
  • Start date
M

michael_quinlivan

Hi all,

I have noticed that the background color of an XML document cannot be
set properly using CSS (that is, you cannot define styles for the BODY
element of an XHTML document).

I have an example of this:
www.houseofnerds.com/mathml_test.xml

Because I am trying to display MathML embedded in the page, I need to
use XML, so I cannot convert this to HTML via XSLT.

The above page renders fine in IE (ignore the giberrish that appears if
you do not have a MathML display plug-in. The important thing is that
it displays the background color as green) However, in Firefox (and I
assume Mozilla and Netscape), the background color is ignored, and it
is white??

Is there any way to acheive a different background color in both
browsers using XML + CSS?? Any other suggestions??
 
M

Martin Honnen

I have noticed that the background color of an XML document cannot be
set properly using CSS (that is, you cannot define styles for the BODY
element of an XHTML document).

I have an example of this:
www.houseofnerds.com/mathml_test.xml

Because I am trying to display MathML embedded in the page, I need to
use XML, so I cannot convert this to HTML via XSLT.

It is hard to tell what exactly is supposeded to happen with that
document as a complex XSLT stylesheet is applied to that input XHTML
with MathML document but in general if you want to set the background
color then try
html, body {
background-color: green;
}
as various browsers depending on their rendering mode have different
views on what constitutes the canvas so it is usually safer to set the
background color on both html and body element.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top