SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Images in CSS called at each page

    Hi,

    I am running a website, which i developed ,i have only one CSS file included in my header. I have four different pages and i have different set of images to be loaded for each page.The images are called in the CSS file.I have tested my site speed using external sites and found that ,when i load my homepage all the images included in the CSS file is getting loaded though all the images are not required in the home page.For example if i have included image4.gif in my CSS which is required for the fourth page in my site ,That image is getting loaded in my home page .Because of this my site speed is getting affected.

    Is this the behavior of the CSS file? if so how can it be changed to load only the images required for the current page.
    Any help is appreciated

    Thanks in advance

  2. #2
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, this is the behaviour of CSS, the client requests it and then downloads it, including all references mentioned there, the client cannot tell which of these are not needed, for example JavaScript could alter the class of an item having the CSS loaded.

    One of the most common performance improvements is using sprites (search for css sprites).

    Other than that, images like your external CSS and Javascript files get cached after being downloaded the first time by the user.

  3. #3
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    And if you want to know how to produce CSS sprites to help the efficiency of image loading, take a read of the following article...

    http://www.alistapart.com/articles/sprites

    Hope that's helpful


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •