多个css文件或一个大css文件? [英] Multiple css files or one big css file?

查看:87
本文介绍了多个css文件或一个大css文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个更好,更快?为什么?

Which one is better and faster? why?

仅使用一个文件进行样式设置

using only one file for styling:

css/style.css

使用多个文件进行样式设置

using several files for styling:

css/header.css
css/contact.css
css/footer.css
css/tooltip.css

我要问的原因是,我为互联网速度非常低的用户开发了一个网站.国家乌干达.所以我想使其尽快.

The reason Im asking it is that im developing a site for users who have very low internet speed. country uganda. So I want to make it as fast as possible.

推荐答案

使用单个文件会更快,因为它需要的HTTP请求更少(假设加载的样式数量仍然相同).

Using a single file is faster because it requires less HTTP requests (assuming the amount of styles loaded is still the same).

因此最好将其保存在一个文件中. 仅当您要例如将IE特定类分开时,才应完成CSS的分离.

So it's better to keep it in just one file. Separating CSS should only be done if you want to keep for example IE specific classes separate.

这篇关于多个css文件或一个大css文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆