一个CSS文件或每个页面的单个CSS文件? [英] One CSS File or individual CSS files for each page?

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

问题描述

当我建立网页时,我要为每个网页建立个别样式表,或是整个网站都有一个大型样式表?为了加载的目的,你不想要一个更小的样式表,为此,使个人是一个更好的做法?

When I am building pages, do I want to have individual stylesheets for each page or one large stylesheet for the entire site? For loading purposes, wouldn't you want a smaller stylesheet, therefor making individual ones is a better practice?

推荐答案

使用单个文件,缓存CSS文件,因此减少为每个访问的新页面下载新文件的需要。

Use a single file, CSS files are cached and therefore reduce the need to download a new file for each new page visited.

为了提供帮助,我通常会通过 CSS清理器以减少其文件大小,此外,您还可以

To help, I usually slap my CSS through a CSS cleaner to reduce its file size, additionally you can GZip CSS using .htaccess too, making it smaller yet again.

最后将所有的CSS文件放到一个文件夹中。在一个单一的文件将使系统范围的变化,演示更容易在未来(我们使用CSS的第一位的全部原因),它也将使调试更容易。

Finally putting all CSS in a single file will make making system wide changes to presentation easier in the future (the entire reason we use CSS in the first place), it will also make debugging easier.

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

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