Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6223125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:26:01+00:00 2026-05-24T08:26:01+00:00

While this could possibly result in a simple yes or no answer I’ll go

  • 0

While this could possibly result in a simple yes or no answer I’ll go for it anyway


Consider the following example:

HTML

<html>
    <head>
    </head>
    <body>
        <div class="foo">
            <span class="bar">Hello world!</span>
            <p>Some really interesting text.</p>
        </div>
    </body>
</html>

CSS

html {
    /* some css */
}
body {
    /* some css */
}
div.foo {
    /* some css */
}
div.foo span.bar {
    /* some css */
}
div.foo p {
    /* some css */
}

Will the order in which css rules appear, have any effect on how (fast) the browser can render the page? ( in this example it won’t really matter, but consider a real website with loads of html and css )

So the above css script will render faster or easier for the browser than :

div.foo p {
    /* some css */
}
div.foo span.bar {
    /* some css */
}
div.foo {
    /* some css */
}
body {
    /* some css */
}
html {
    /* some css */
}

Do browsers care?
Should we?


Read before asking:

  • Is this how you would structure your CSS stylesheet?
  • What's the best way to organize CSS rules?
  • How do browsers read and interpret CSS?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:26:02+00:00Added an answer on May 24, 2026 at 8:26 am

    After some more testing and reading I came to the following conclusion, no, it does not matter. Even after some ‘extreme’ testing, I could not find anything that supports the idea that the order matters.

    There were no ‘flashed of unstyled content’ or the likes, it just took way longer to load the page ( way way longer 😀 )

    Tests I ran
    I created a test page with 60.000 div elements, each having a unique ID attribute. Each of these ID’s had their own css rule applied to it. Below that I had a single span element with a CLASS attribute, which was also had a css rule linked to it.

    These tests created a html file of 2MB with a corresponding css file of 6MB.

    At first I attempted these tests with 1.000.000 divs and css rules, but Firefox did not approve and started crying, begging me to stop.

    I generated these elements and their css with the following simple php snippets.

    <?PHP
    
        for ($i = 0; $i < 60000; $i++) {
            echo "
    #test$i {
        position: absolute;
        width: 1px;
        height: 1px;
        top: " . $i . "px;
        left: 0;
        background: #000;
    } <br />
    ";
        }
    
    ?>
    

    And

    <?PHP
    
        for ($i = 0; $i < 60000; $i++) {
            echo "
    <div id=\"test$i\"></div>
    ";
        }
    
    ?>
    

    The result was put in a html and css file afterwards to check the results.

    Mind you, my browser ( Firefox 5 ) really did not appreciate me playing around with this, it really had some issues generating the output, the occasional this program is not responding message was not afraid to show it’s face.

    These tests were ran on a localhost, ran by a simple XAMPP installation, it might be possible that external servers result in a different resultset, but I am currently unable to test that.

    I tested a few variations on the above:

    • Placing the element before all the generated divs, in the
      middle and at the end
    • Placing the span’s css definition before, in the middle or at the end
      of the css file.

    Oh and may I suggest: http://www.youtube.com/watch?v=a2_6bGNZ7bA while it doesn’t exactly cover this question, it does provide some interesting details about how Firefox ( and possibly other browsers )work with the stuff we throw at it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider following simple, illustrating example cf = Block[{a, x, degree = 3}, With[{expr =
a while ago i could comment any code in php with netbeans like this:
I have the following code: Bear in mind that while this code works on
I have been trying to solve this problem for a while, but couldn't with
Why does this work: List<?> list = new LinkedList<Integer>(); while this gives a type
I wanna verify a digitally signed xml against its schema definition while this schema
G'day, Edit: While this question covers a situation that can arise in programming a
If a is undefined, this works: if(window.a) {} while this throws an error: if(a)
We're currently running an svnserve instance as NT service. While this works, it's needlessly
Linux provides the stime(2) call to set the system time. However, while this will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.