473,386 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Cannot set background color (XML+CSS)

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

Jul 24 '05 #1
2 6251
Op 6 Jul 2005 00:16:40 -0700 schreef mi***************@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=ht...thml_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
br*********************@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Jul 24 '05 #2

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=ht...thml_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

Jul 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marek | last post by:
When I use "list-style-type:decimal;" in Mozilla I get numbering only with "zero": 0. aaaa 0. bbb 0. cccc Why there is no incrementation? In IE 6.0 there is no numbering: aaaa bbb cccc
2
by: john schultz | last post by:
is there a standard file format that encapsulates some xml data and a stylesheet with which to display it in one file? ...and which doesn't require an internet connection. of course xml lets you...
1
by: michael_quinlivan | last post by:
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...
0
by: Chris | last post by:
We are looking for a highly experienced and extremely good PHP programmer to work on our PHP driven site. You will also need knowledge of XML and Mod Rewrite, CSS and javascript. We are UK based...
0
by: Jon | last post by:
From: Michael Day <mikeday@yeslogic.com> Subject: Prince 5.0: XML + CSS to PDF formatter We are very happy to announce the release of Prince 5.0, a new version of our batch formatter for...
2
by: ricky | last post by:
Hello, If anyone could help me with this I would highly appreciate it. I've tried everything and nothing works. What I am trying to do is so damn basic and it's just frustrating that it seems...
6
by: Dan H | last post by:
I'm trying to apply CSS to an XML file and interject a JavaScript function into the page. I have the following source code: foo.xml ====== <?xml version="1.0" encoding="UTF-8"?>...
1
by: jearnshaw | last post by:
Newbie Moment!! I hope you guys can help. I admit it I know NOTHING about xml and css. But I need to get a large amount of data out of xml and onto an intranet site which uses restricted html.I...
1
by: sakthit | last post by:
If a list box is overlapping a page if u adjust the width of the list box then contents inside the list box got affected because of unlimited size.so how to use overlap attributes here. ive me with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.