XML and CSS

H

Hal

Hi all

I hope somebody can help me, as this problem is causing me to lose my hair!
;-)

I am new to XML, and am just beginning to see the great potential and
possiblities of the technology. However, after following some examples. I
am experiencing very different results when my files are viewed in Firefox
compared with IE. In all cases, IE lays out and formats the XML file as
expected, but Firefox does not. Please see the following example. Note
that if I remove the 'class="one/two"' in my xml file, and the "husband.xxx"
classes (and the second husband class) in my css file, this displays fine in
Firefox.

I'd really appreciate some guidance.

With thanks
Hal

[people2.xml]
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/css" href="people2.css"?>
<!-- this is a list of people -->
<people>
<husband class="one" employed="yes">
<name>Mark</name>
<age>46</age>
<wife>
<name>Janet</name>
<age>42</age>
</wife>
</husband>
<husband class="two" employed="no">
<name>Peter</name>
<age>33</age>
<wife>
<name>Sally</name>
<age>28</age>
</wife>
</husband>
</people>





[people2.css]
husband.one {
font-family:arial, sans-serif;
font-size:16px;
font-weight:bold;
font-style:italic;
text-align:center;
color:black;
display:block;
background-color:green;
margin-bottom:6px;
width:200px;
padding:40px;
border:eek:utset;
position:absolute;
left:80px;
top:95px;
}
husband.two {
font-family:arial, sans-serif;
font-size:16px;
font-weight:bold;
font-style:italic;
text-align:center;
color:black;
display:block;
background-color:blue;
margin-bottom:6px;
width:200px;
padding:40px;
border:eek:utset;
position:absolute;
left:180px;
top:195px;
}
wife {
font-family:courier,sans-serif;
font-size:11px;
color:white;
display:block;
background-color:inherit;
}
 
M

Martin Honnen

Hal wrote:


<husband class="one" employed="yes">
husband.one {

This is arbitrary XML so an attribute class does not have any
predefinedd meaning as a CSS style class.

You need a selector in the form
husband[class~=one]
at least for an implementation supporting CSS 2 (which IE 5/6 certainly
do not).
 

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

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top