Sorry everyone, I just discovered what the problem was:

I have multiple style sheets and the browsers were only applying one,
not two as required, due to my misuse of the 'name' attribute of the
stylesheet instruction, as illustrated below.

This was incorrect:

<?xml-stylesheet href="../../../Styles/Default.css" type="text/css"
alternate="no" title="Default" media="screen, projection"?>
<?xml-stylesheet href="../../../Styles/Lesson.css" type="text/css"
alternate="no" title="Lesson" media="screen, projection"?>
<?xml-stylesheet href="../../../Styles/Print.css" type="text/css"
alternate="yes" title="Print" media="print"?>

... as the 'name' attribute must be the same for all stylesheets that
you want the browser to apply by default using the cascade. The
following fixed the problem:

<?xml-stylesheet href="../../../Styles/Default.css" type="text/css"
alternate="no" title="Screen" media="screen, projection"?>
<?xml-stylesheet href="../../../Styles/Lesson.css" type="text/css"
alternate="no" title="Screen" media="screen, projection"?>
<?xml-stylesheet href="../../../Styles/Print.css" type="text/css"
alternate="yes" title="Print" media="print"?>

As the 'title' attribute is optional you might be best leaving it out!

Kind regards,

Grant Bailey


-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Grant Bailey
Sent: Thursday, 17 December 2009 7:41 PM
To: [email protected]
Subject: [WSG] Using CSS to select a tag having an ID attribute: page
served as application/xhtml+xml


Hello,

I've recently started serving my web pages as xml pages using the MIME
type application/xhtml+xml rather than text/css as previously. This
works fine as my pages were already xhtml compliant, with one exception:
my external CSS stylesheets are no longer honoured by any browser to the
extent that they select ID attributes.

For example:

[XHTML]
<div id="div_Heading"> 
  <h1>Survival: the basics</h1>
</div>

[CSS]
#div_Heading {
border: thin black solid;
}

If I serve my page as text/css the border appears as expected but when
the page is served as application/xhtml+xml, no border is visible. There
is only one ID named div_Heading in the document and the document itself
validates.

Could someone please advise me what might be going wrong as I have been
unable to find anything of assistance on the web or in the WSG forums.

Many thanks and regards,

Grant Bailey




*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]
*******************************************************************




*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]
*******************************************************************

Reply via email to