tags:

views:

372

answers:

4

I am using the django framework and am using templates, inheriting a lot of admin base templates. What am wondering is: can I have more than one CSS file in one HTML file? i.e. maintain the django admin CSS file but then have another CSS file of my own with different styles!

+1  A: 

Yes, you can. But if you try to override any of the CSS in the django admin CSS, you'll have to use !important in your style definitions.

Salty
Not necessarily - you just have to define yr CSS using more 'specificity' so that your rules take precedence over the django CSS. Using !important can cause problems when trying to debug your CSS further down the line, so I'd suggest you use it with caution.
codeinthehole
+8  A: 

Yes you can. Just place the tags to the CSS files or embed the style in style tags.

Ricardo Acras
A: 

Of course, that's why they are called Cascading Style Sheets, because you can have a dozen of them applied in succession.

Karl
No, they are called Cascading Style Sheets because the rules *cascade* through the document. Not because you have lots of them applied in succession.
Ryan Doherty
ryan's comment +1
annakata
Just don't try 3 dozen... http://www.agum.com/web/2008/03/11/internet-explorer-issue-maximum-of-32-css-import/(Also, ryan's comment++)
Andy Ford
+1  A: 

Just to add that whilst multiple css files are of course possible, it is actually best practice for you to merge the css (programatically if possible) into as few files as possible.

Fewer files = fewer http requests = better responsiveness for the end user.

annakata