Reputation: 78686
Let's say we have a page with the some simple HTML/CSS like below. Does the browser also read .b
and .c
in the stylesheet?
HTML
<div class="a">1</div>
<div>2</div>
<div>3</div>
CSS
.a { color: aqua; }
.b { color: blue; }
.c { color: cyan; }
That is just an example, but in the real world there might be hundreds, thousands lines of CSS code isn't being used, such as using Bootstrap for a very very small project.
Upvotes: 6
Views: 208
Reputation: 3809
Yes all the rules are loaded in the memory, this is why when you add new element to your DOM (e.g. by using javascript) you see that the style automatically applies to them.
Upvotes: 4