SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Performance: Many CSS files for media queries vs 1 big CSS file with queries inside?

    I am wondering what is better for performance. If I have media queries defined like this:

    Code:
    <link rel='stylesheet' media='screen and (min-width: 150px) and (max-width: 630px)' href='mobile.css' />
    <link rel='stylesheet' media='screen and (min-width: 631px) and (max-width: 768px)' href='almost_mobile.css' />
    Now let's say my browser width is 600. Does the browser load EVERY css file in advance, or does it only load the almost_mobile.css, and when I minimize below 630px, it will then load mobile.css?
    If it loads all files at once on page load, then it would probably be smarter to include all the CSS in one big file (http requests) and configure the media queries inside of this CSS file, right?

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    It downloads all of them.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! Queston answered .


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
  •