473,670 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6275
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************* ********@tiscal i.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
1358
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
1327
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 reference a remote stylesheet with a url, but I'm looking for something that actually stores the stylesheet WITH the xml. any ideas?
1
1397
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 example of this: www.houseofnerds.com/mathml_test.xml Because I am trying to display MathML embedded in the page, I need to
0
1231
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 but are willing to try outsourcing. We can give you fulltime for at the very least a month or part-time (depending on hours and workrate). Our site is fairly complex and everything has been custom coded, no PEAR or Smarty etc, so you will need...
0
1215
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 converting XML + CSS into PDF. - Even more CSS support - Even more PDF features - Quick and easy server integration
2
3941
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 there's no support for this. Either that or I'm doing something wrong. Well, enough venting, here's what I need. Using this sample XML file (test.xml):
6
1359
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"?> <?xml-stylesheet href="foo.css" type="text/css"?> <doc> <element1>
1
3113
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 may be able to use css (if our new outsourced IT dept lets me) but I am having difficulty figuring out how to get the style sheets to do what i need. My page is as follows:
1
1081
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 clear idea. thanks in advance
0
8471
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8903
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5686
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.