#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    24
    Rep Power
    0

    CSS not applied in DIV tags for NS


    My CSS stylesheet is not taking effect within a DIV tag itself or if enclosed within a DIV tag, when viewed in Netscape 4.7.

    Example 1:
    <div id="layerID" class="some_class_name" style="position: absolute; blah: blah">
    ...some html here...
    </div>

    Example 2:
    <div id="layerID">
    some html and then <font class="some_class_name">blah</font>
    </div>


    In both cases, the codes work fine in IE and NS6. The CSs stylesheet works fine in Netscape 4.7 if applied elsewhere in the document.

    Can someone please tell me if there's a work around for this problem? (Netscape ought to be banned from the Internet!! Arghh...)

    Thanks guys...
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    24
    Rep Power
    0

    Correction


    There should be a ' ; ' after the last 'blah' in Example 1.
  4. #3
  5. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Other than not applying CSS to a <font> tag (sort of defeats the purpose of CSS) try taking out underscores - if any - in your CSS id/class selectors. This kills NS4.x CSS - incorrectly, of course.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    24
    Rep Power
    0
    There are no underscores in the class names and I'm actually not using any <font> tags.

    Example 2 should have been:
    <div id="layerID">
    <a href="url" class="classname">some text</a>
    </div>

    Using CSS within these div tags will save me a lot of work (which is what CSS is for) as they are part of my menu system. Any other work arounds?

    I've even tried to use the parameters directly in the div body but it doesn't work either. e.g.

    <div id="layerID">
    <a href="url" font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; color: #CCCC00; text-decoration: none; margin-left: 5px;>some text</a>
    </div>

    OR

    <div id="layerID">
    <a href="url"><font font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; color: #CCCC00; text-decoration: none; margin-left: 5px;>some text</font></a>
    </div>

    Is it simply not possible for such parameters to be applied within DIV tags??

    Thanks...
    Last edited by teddy; October 18th, 2001 at 11:06 PM.
  8. #5
  9. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    teddy:

    The various style attributes are strictly CSS - you have to package them in the HTML style="" attribute to apply them:

    <div id="layerID">
    <a href="url" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; color: #CCCC00; text-decoration: none; margin-left: 5px;">some text</a>
    </div>

    Inline style is, to say the least, buggy in Navigator; class and id selectors are more reliable. Layers complicate things. If you could post the exact code - within reason - the problem would probably be familiar to someone.
    Last edited by adios; October 19th, 2001 at 03:04 AM.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    24
    Rep Power
    0
    I'm actually redesigning my faculty's website and am completely new to web development. You can take a look at what I've done, which is pretty much done as time is running short, at www.eelab.usyd.edu.au/~thian_ck/index.php

    You'll notice that the menu system is fine on IE and NS6 but not other versions of Netscape.

    Please help... if I can't fix it, I'll probably just let it be... Hate Netscape!!!

    Thanks Adios!
  12. #7
  13. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    teddy -

    a lotta code....
    no time now, but a hint: you've got a layer inside a layer, and the CSS isn't being applied to the <a>s in the nested layer. You might want to try putting the rules directly inline (in the <a> tags) to force it to be rendered. If that doesn't help, I've had occasion to wrap <span>s around links to apply CSS. Best bet is always two style sheets (at least) - one for NS4, one for the non-crippled clients, imported separately with scripted <link> tags.

    hang in there....

    rob
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    24
    Rep Power
    0
    I'm not too familiar with <span>s, inline, and dual stylesheets. Care to elaborate Adios? Thanks mate... really appreciate your help...
  16. #9
  17. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
  18. #10
  19. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    24
    Rep Power
    0
    What are the main differences between a CSS for NS and for IE anyway? I know now how to have two or more seperate stylesheets for different browsers, but how different should the codes be?

    Sorry to be such a pain... : ( And thanks for your patience.
  20. #11
  21. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    http://www.webreview.com/style/index.shtml

    Sometimes you need to experiment, adding style rules until Netscape breaks...tons of fun.

    I'd extract a small section of the menu, with just the container layers and one link, and experiment on that, trying inline styles if necessary, and adding rules one at a time, trying not to use obscenities any more than necessary.

    adios
  22. #12
  23. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    24
    Rep Power
    0
    Very helpful stuff Adios. Thanks! Will try them out when I get time...

    Cheers!

IMN logo majestic logo threadwatch logo seochat tools logo