[英]Linking CSS Files in HTML
Is it a good practice to use two to three stylesheets for a web design. 在网页设计中使用两到三个样式表是一个好习惯。 1. framework that we are using, 2. Main stylesheet 3. Responsive stylesheet which would have media queries.
1.我们正在使用的框架,2.主样式表3.带有媒体查询的响应式样式表。 How does it matter if we put media queries into the main stylesheet?
如果将媒体查询放入主样式表有什么关系? Is there a difference in performance?
性能上有区别吗? What are the pros and cons of embedding 2 stylesheets instead of one?
嵌入2个样式表而不是一个样式表的利弊是什么?
Loading multiple stylesheets: 加载多个样式表:
Unless you are frequently changing one of them, you will always get better performance by having them in a single file (this may change with HTTP2). 除非您经常更改其中之一,否则将它们放在单个文件中将始终获得更好的性能(这可能会因HTTP2 而改变)。
The only benefits to having them in separate files is for ease of development, but you should combine them at build time. 将它们放在单独的文件中的唯一好处是易于开发,但是您应该在构建时将它们组合在一起。
I'll recommend using CSS preprocessors, such as LESS/SASS. 我建议使用CSS预处理程序,例如LESS / SASS。
Those allow additional leverage over CSS by providing additional syntax that delivers lots of advantages: 通过提供具有许多优点的附加语法,它们可以比CSS更好地利用:
You can read more about this here: Advantages of preprocessors 您可以在此处了解更多信息: 预处理器的优势
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.