title: Can CSS be more efficient if it is better specified?
body: <p>This question is about how specific CSS should be specified.<br>
  Lets say we have this html page:</p>
  
  <pre><code>&lt;!DOCTYPE&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;link rel="stylesheet" type="text/css" href="style.css" /&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div&gt;
        &lt;span class="container"&gt;
          Hello World!
        &lt;/span&gt;
        &lt;span&gt;
          Goodbye World!
        &lt;/span&gt;
      &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And we want the "Hello World" text to show up red, but not the "Goodbye World!".</p>
  
  <p>In that case we can simply do:</p>
  
  <pre><code>.container {
    color: #FF0000;
  }
  </code></pre>
  
  <p>This will work, because a class is specified for the "Hello World" container. But is this efficient? I mean, the web browser has to look through all HTML available to find the one with the class "container". If we were to the same thing as done above, but being more specific we would get:</p>
  
  <pre><code>html body div span.container {
    color: #FF0000;
  }
  </code></pre>
  
  <p>This way only the span, with the class "container", within a div, within the body, within the html tag will be affected. By being this specific I'd say the web browser is given a lot more directions in what to do. The time it needs to search for the element would, as it seems, be reduced.</p>
  
  <p>Now my question is:<br>
  Can the web browser apply the CSS more efficient if it is better specified?</p>