2 style sheets overriding each other

by "Hilma" <Hilma(at)hilma.freeserve.co.uk>

 Date:  Sun, 26 May 2002 07:25:20 +0100
 To:  <hwg-basics(at)hwg.org>
  todo: View Thread, Original
Good morning!

i have a code problem (now, there's a suprise)

My *plan* was to have a standard css, overridden by the NS one for the
classes that need special treatement in NS4:

----------------------------------------------------------------------------
---------------------------------------------------

<title>About Us - The Friends of Holly Hill</title>
<script type="text/JavaScript" src="HH_Menus.js"></script>

<link rel="stylesheet"
      type="text/css"
   href="HH_Style01.css"                                   <!-- NORMAL STYLE
SHEET -->
   >


<!--Give NS4 a style sheet without borders -->
<script type="text/javascript">
<!--
    if (!document.getElementById)
      document.write('<link rel="stylesheet" type="text/css"
href="HH_StyleNS4.css"/>');

// -->
</script>

----------------------------------------------------------------------------
---------------------------------------------------
BUT this does not work; NS4 gets the Style01 style.

Whereas If i omit the first buit of code, and jsut offer the alternatives:

----------------------------------------------------------------------------
---------------------------------------------------
<script type="text/javascript">
<!--
    if (document.getElementById)
       document.write('<link rel="stylesheet" type="text/css"
href="HH_Style01.css"/>');

    else
      document.write('<link rel="stylesheet" type="text/css"
href="HH_StyleNS4.css"/>');
    end if
// -->
</script>
----------------------------------------------------------------------------
---------------------------------------------------


Then it works.
But then i have to have a whole new style sheet for NS4, instead of just the
bits that don;t work  in it.

I thought that any classes in a later style sheet would override those
earlier defined  one,
so my first  code has all the good stuff, and the second has overrides for
stuff that doesn;t work in the first.standard, ,all-browser sheet.

But this doesn;t appear to work - at least, the first bit of code ises the
first style sheet classes, even for  (!document.getElementById)  browsers
(NS4).

If  you see what i mean!

thanks -


h.

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA