CSS taking time to kick off when page is requested?

Discussion in 'CSS' started by fluid, Jul 30, 2006.

  1. #1
    I have a website which uses CSS to place the page elements in the right positions (absolute positioning). Using DIVs i restrict the spaces for each section of the page and float to align them. But i've noticed that when a page is requested, the elements are displayed in the way that source code is read and when the CSS kicks in, the elements are then properly formatted. Now this is a nuisance and i would like to know if something can be done about it.

    I'm using @import url(styles.css); syntax.

    PS: The time taken for the CSS to kick in is about 2-4 seconds but it is highly noticeable.

    So if any of you had the same problem, can you please share the solution?
     
    fluid, Jul 30, 2006 IP
  2. esnstudio

    esnstudio Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's probably because your CSS file is huge. You could try compressing it and see if it solves the problem?
     
    esnstudio, Jul 30, 2006 IP
  3. fluid

    fluid Active Member

    Messages:
    679
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    70
    #3
    Do you think 19k is too big?
     
    fluid, Jul 30, 2006 IP
  4. AdamSee

    AdamSee Well-Known Member

    Messages:
    422
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Using link rel should sort it. Google 'FOUC' as well.

    <link rel="stylesheet" type="text/css" media="screen" href="/css/screen.css"/>
    Code (markup):
    19k is quite a large CSS file, but if it's a full site with lots of pages, then it isn't too bad.
     
    AdamSee, Jul 30, 2006 IP
  5. CCD

    CCD Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Agreed - what AdamSee says is right - Google 'FOUC' or 'flash of unstyled content' for many pages that should help you.
     
    CCD, Jul 30, 2006 IP
  6. fluid

    fluid Active Member

    Messages:
    679
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    70
    #6
    Thank you for your replies.

    I will change the @import to 'link rel..' and test to see if it really works.
     
    fluid, Jul 30, 2006 IP
  7. web-spy

    web-spy Active Member

    Messages:
    127
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    93
    #7
    web-spy, Jul 30, 2006 IP