Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts

    How is CSS load time determined?

    I was wondering how css load time is determined? Let's say I had a 10,000 line css document, I'm wondering what would be the fastest way to structure it for it to load. (I know there are css compactors online) Can someone who really understands css load time answer these questions with: 1st faster, same, or 2nd faster

    (1st faster)
    Code:
    a { color: #DDD; }
    Code:
    a {
        color: #DDD;
    }
    Which one is faster?
    Code:
    a                 { color: #DDD; }
    Code:
    a { color: #DDD; }
    Which one is faster?
    Code:
    a /* hi, i am a comment */ { color: #DDD; }
    Code:
    a { color: #DDD; }
    Which one is faster?
    Code:
    /* Hello
       I am a comment
    */
    Code:
    /* Hello I am a comment */
    Thanks guys! I'm very curious to know whether comments and blank space effect load time.
    Last edited by Sammy12; 11-14-2011 at 02:29 AM.

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    bumping

  • #3
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    It will be negligible at best. Format it in the easiest way to edit.

  • #4
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    interesting. what if my website was facebook? whould the difference still be negligible?

  • #5
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,226
    Thanks
    10
    Thanked 269 Times in 268 Posts
    The savings one way or the other will be minute. But if you're concerned about speed, no reason to put extra spaces, semicolons and returns into a file, unless it makes it confusing or harder to manage. So if it were me, I'd be formatting like:
    Code:
    a {color:#DDD}
    And using comments formatted for easiest reading (i.e. not trying to compress them, because after all, the best readability is the whole point behind a comment).

    Dave

  • Users who have thanked tracknut for this post:

    Sammy12 (11-16-2011)

  • #6
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    so I'm guessing it's determined by how much "space" you use, all the white space also counts

    Thanks!

  • #7
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,226
    Thanks
    10
    Thanked 269 Times in 268 Posts
    "space" must be first downloaded to the client system, then must be parsed through and thrown away. So you're hit twice for it.

    Dave


  •  

    Posting Permissions

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