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

    Join Date
    May 2003
    Posts
    63
    Rep Power
    12

    CSS only works after refresh?


    I have a page with CSS that only seems to work after the page is refreshed.

    http://machinemess.singaporeanimenews.net/0index.php

    When you first access the page url, you see the html text, but the styles defined in my styles.css do not get applied.

    However, when you click 'refresh', the styles appear alright.

    Is there a reason for this?

    This is the style definition I have in 0index.php:

    Code:
    <html>
    <LINK REL="SHORTCUT ICON" HREF="mm.ico">
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="reply-to" content="NOSPAMadmin@singaporeanimenews.net" />
    <meta http-equiv="imagetoolbar" content="no" />
    <meta content="TRUE" name="MSSmartTagsPreventParsing" />
    
    <head>
    <title>Machine Mess Singapore Modeling Community</title>
    <style type="text/css" media="screen">
    @import url( mm-styles.css );
    
    	#banner {
    		margin: 2em auto;
    		background-image: url(mm-logobig.jpg);
    		background-color:#fff;
    		color:#000;
    		height:140px;
    		width:830px;
    		border-top:0px solid #000;
    		border-right:0px solid #000;
    		border-left:0px solid #000;
    		voice-family: "\"}\"";
    		voice-family: inherit;
    		}
    
    </style>
    </head>
    ..
    ..
    ..
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1099
    It's caused by the use of @import. An alternate method is to use
    Code:
    <link rel="stylesheet" type="text/css" href="mm-style.css" />
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    63
    Rep Power
    12
    May I know what's the exact problem the @import is causing?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    63
    Rep Power
    12
    In addition, this doesn't seem to work.

    <LINK REL="SHORTCUT ICON" HREF="mm.ico">


    The file exists.. I'm trying to make IE use this icon when the page is bookmarked.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    63
    Rep Power
    12
    Changed the style sheet line, but the problem is the same. It only works after I refresh the page.


    Code:
    <html>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="reply-to" content="NOSPAMadm@singaporeanimenews.net" />
    <meta http-equiv="imagetoolbar" content="no" />
    <meta content="TRUE" name="MSSmartTagsPreventParsing" />
    
    <head>
    <title>Machine Mess Modeling Community</title>
    <LINK REL="SHORTCUT ICON" HREF="mm.ico">
    
    <link rel="stylesheet" type="text/css" href="mm-styles.css" />
    <style type="text/css" media="screen">
    
    	#banner {
    		margin: 2em auto;
    		background-image: url(mm-logobig.jpg);
    		background-color:#fff;
    		color:#000;
    		height:140px;
    		width:830px;
    		border-top:0px solid #000;
    		border-right:0px solid #000;
    		border-left:0px solid #000;
    		voice-family: "\"}\"";
    		voice-family: inherit;
    		}
    
    </style>
    </head>
    Is there a way to make the browser load the CSS before it loads the html on the page?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    15
    When you first access the page url, you see the html text, but the styles defined in my styles.css do not get applied.
    No! The html text is NOT completely there when first loading the page.
    All lines up to the point '1 Guests, 1 Users' are not present (according to View Page Source).

    I think your PHP code is faulty at some point.
    My first guess: it tries to set an http-header too late in the process.

    If I remove the session id/cookie using my cookie manager, and then refresh, it's as wrong as first loading the page.

    Hope this helps,
    Jeroen

IMN logo majestic logo spyfu logo threadwatch logo seochat tools logo