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!
我正在使用django框架并使用模板,继承了大量的管理员基础模板。我想知道的是:我可以在一个HTML文件中拥有多个CSS文件吗?即维护django admin CSS文件,但随后又有另一个我自己的CSS文件,不同的样式!
4 个解决方案
#1
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.
只是添加虽然多个css文件当然是可能的,但实际上最好将css(如果可能的话以编程方式)合并到尽可能少的文件中。
Fewer files = fewer http requests = better responsiveness for the end user.
更少的文件=更少的http请求=更好的最终用户响应能力。
#2
Yes you can. Just place the tags to the CSS files or embed the style in style tags.
是的你可以。只需将标记放在CSS文件中或将样式嵌入样式标记即可。
#3
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.
是的你可以。但是如果你试图覆盖django admin CSS中的任何CSS,你将不得不在你的样式定义中使用!important。
#4
Of course, that's why they are called Cascading Style Sheets, because you can have a dozen of them applied in succession.
当然,这就是为什么它们被称为层叠样式表,因为你可以连续应用它们中的十几种。
#1
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.
只是添加虽然多个css文件当然是可能的,但实际上最好将css(如果可能的话以编程方式)合并到尽可能少的文件中。
Fewer files = fewer http requests = better responsiveness for the end user.
更少的文件=更少的http请求=更好的最终用户响应能力。
#2
Yes you can. Just place the tags to the CSS files or embed the style in style tags.
是的你可以。只需将标记放在CSS文件中或将样式嵌入样式标记即可。
#3
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.
是的你可以。但是如果你试图覆盖django admin CSS中的任何CSS,你将不得不在你的样式定义中使用!important。
#4
Of course, that's why they are called Cascading Style Sheets, because you can have a dozen of them applied in succession.
当然,这就是为什么它们被称为层叠样式表,因为你可以连续应用它们中的十几种。