#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    Aberdeen, Scotland
    Posts
    48
    Rep Power
    12

    CSS not showing in netscape


    Hi,

    I'm working on a webpage, and was beginning to get quite affectionate with the way it looks, when somebody suggested I'd better test it in Netscape Navigator (I use Internet Explorer 6). So, I downloaded NN 7.1, and Aarghh!! For some reason, it's completely ignored the external style sheet I've linked to and looks comparatively rubbish!

    I'd be grateful if anybody could tell me why that could be.
    In the page head I have:

    Code:
    <link rel="stylesheet" href="sheet1.css" type="text/css">
    In the style sheet I have (for example):

    Code:
    <style>
                    <!--
    	body 	{background: black;
    		scrollbar-base-color:rgb(255,129,23);
    		scrollbar-track-color:rgb(255,129,23);}
    	-->
    </style>
    
    
    <style>
    	<!--
    		.main	{
    			color: white;
    			text-align: left;
    			font-style: normal;
    			font-size: medium}
    	-->
    </style>
    In the page code:

    Code:
                   <p class = "main">
    		This section is under construction- please visit again soon.
    	</p>
    -The stylesheet is completely ignored, seemingly. Help!!!
  2. #2
  3. |<.+#f@#+.&.|
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2002
    Location
    norway
    Posts
    3,009
    Rep Power
    1224
    remove the tags and html comments from the css file.

    Code:
    body 	{
    	background: black;
    	color:white; /* always supply a color if you have a set a background */
    	scrollbar-base-color:rgb(255,129,23); /*silly msie style should be avoided */
    	scrollbar-track-color:rgb(255,129,23); /*silly msie style should be avoided */
    }
    
    .main	{
    	background:transparent; /* same as above */
    	color: white;
    	text-align: left;
    	font-style: normal;
    	font-size: medium;
    }
    the comments in the /* */ are not neccesary
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    Aberdeen, Scotland
    Posts
    48
    Rep Power
    12
    Akh,

    much appreciated, that worked! I'll also take on board your CSS advice.

    I have a question though:

    Will this change affect how the page appears in older browsers? I thought the tags were necessary.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    42
    Rep Power
    12
    no and no
    tags are only for internal style sheets

    and as for the obvious - why would a CSS file (file only for style sheets only) need something to tell it is a stylesheet.
    Mistakes are made, you pay for them.. then you do it again
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    Aberdeen, Scotland
    Posts
    48
    Rep Power
    12
    now you mention it, that is kinda obvious.

    Do you use the <-- comments --> for internal style sheets (I'm guessing yes)?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    Aberdeen, Scotland
    Posts
    48
    Rep Power
    12
    now you mention it, that is kinda obvious.

    Do you use the <-- comments --> for internal style sheets (I'm guessing yes)?
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    42
    Rep Power
    12
    you use /* and */ for comments in style sheets just like in js
    IMPORTANT: no // one line comments

    this is because style sheets often have <!-- and --> in them anyway as it blocks older browsers who don't understand css from displaying the code on the output page

    <style type="text/css">
    <!--

    /* this is to set the bg of the body to blue */
    body{background-color:#0000ff}

    /* this is another comment */

    -->
    </style>

    hope this helps
    Mistakes are made, you pay for them.. then you do it again
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    Aberdeen, Scotland
    Posts
    48
    Rep Power
    12
    That helps a lot. Appreciated.

IMN logo majestic logo threadwatch logo seochat tools logo