Click here to get back home

Cannot set background color (XML+CSS)

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Cannot set background color (XML+CSS) michael_quinlivan 07-06-2005
Posted by michael_quinlivan on July 6, 2005, 12:16 am
Please log in for more thread options


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


Posted by Bart on July 6, 2005, 11:16 am
Please log in for more thread options


Op 6 Jul 2005 00:16:40 -0700 schreef michael_quinlivan@hotmail.com:

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

I've no experience in xml/xhtml/xls but:

First of all, your page throws multiple errors when validating
(http://validator.w3.org/check?uri=http%3A%2F%2Fwww.houseofnerds.com%2Fmathml_test.xml),
maybe you should solve these first.
Second: put a border around the body, this will show you that the main
content is outside the body.

If you remove the xml stylesheet (I can't see what it does anyway),
the css takes effect in FF: the line containing "MathML Test Page" has
a green background (this _is_ the body).
You might consider applying a background to html instead:
html{ background-color: #c8ffc8;}

Hope this is of any use to you.

Bart
--
Bart Broersma
broersma.juda_ANTISPAM_@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)

Posted by michael_quinlivan on July 6, 2005, 4:43 am
Please log in for more thread options




> I've no experience in xml/xhtml/xls but:

Hehe, neither do I, and if it wasn't for the MathML there is no way I
would have
put myself through the hell of trying to get this to work in XML

>
> First of all, your page throws multiple errors when validating
>
(http://validator.w3.org/check?uri=http%3A%2F%2Fwww.houseofnerds.com%2Fmathml_test.xml),
> maybe you should solve these first.

...would not know how to solve this. I ripped off the code from
another site.

> Second: put a border around the body, this will show you that the main
> content is outside the body.

it may render that way, but I still don't understand why. After all,
the main content is clearly inside the body in the source file. Let's
blame this on XML again :)

> If you remove the xml stylesheet (I can't see what it does anyway),

Neither do I, but if I remove it, IE breaks...

> You might consider applying a background to html instead:
> html{ background-color: #c8ffc8;}

Thank u Bart, you have been a great help. The above worked for me.
One day I will get around to figuring out XML and XSL, but I find it
irritating that
such a seemingly simple task I thought would take a couple of hours
would take three days :P

thanks again
MQ


Similar ThreadsPosted
cell background color February 15, 2005, 1:23 pm
background color of a frame May 26, 2006, 12:03 pm
background-color: #777777 not working in CSS August 3, 2004, 4:20 pm
Cannot print table background color May 30, 2005, 4:27 am
Changing background color of a frameset June 17, 2005, 2:16 pm
how can i change all disabled inputs background color ? February 28, 2006, 10:58 pm
Google tool bar changes text input background color November 14, 2007, 2:50 pm
URGENT: Making rows with background color seemless June 5, 2008, 10:10 pm
Tradeoffs of setting background-color on html vs. body? August 19, 2008, 12:41 pm
Mac/Safari Gamma Problem matching HTML color to GIF color? April 18, 2006, 1:56 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap