I'm working on a large project in asp.net. I like breaking it apart by user controls so I was wondering if it would be OK to load the css in the user control code instead of in master page header?
Chances are, some of those controls would be represented multiple times on a single page so there would be duplicate style tags, would the browsers reload them or just ignore in that case?
the browser will load twice the css file, but in the second time it will probably cached, so it will be much faster.
the issue is, loading the file is not the only overhead here, because the browser will also need to re parse the css file, and re iterate the DOM tree, to check if any of the nodes in it match the new selectors, and then to apply them.
you are probobly better of including the css file once, and you should also look into css bundling, and minification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With