Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use multiple css stylesheets in the same html page

How would I use multiple CSS stylesheets in the same HTML page where both stylesheets have a banner class, for instance. How do you specify which class you are referring to?

like image 844
Lilz Avatar asked Nov 26 '10 10:11

Lilz


People also ask

How do I link multiple CSS stylesheets in HTML?

Note: There are two different ways to import a CSS file into another using @import url(“style2. css”); or @import “style2. css”; or directly import any CSS file or multiple CSS file in the HTML file directly within <style>@import “style1.

Can you have 2 stylesheets in HTML?

Answer. Yes, you can apply more than one stylesheet to an HTML file. For each stylesheet you link to a page, you would just need to add an additional <link> element.

Can we link multiple stylesheets to a single page?

Yes, you can include multiple style sheets, but you need to label them as alternate style sheets and give the user some way to activate them using JavaScript - perhaps by clicking a link.


1 Answers

Style sheets are, effectively, concatenated into a single style sheet in the order in which they appear in the HTML source.

The normal rules for applying rulesets then apply (i.e. by specificity with the last ruleset that defines a given property winning in the event of a tie and !important throwing a spanner into the works)

like image 106
Quentin Avatar answered Oct 09 '22 01:10

Quentin