为了性能,使用一个或多个css文件? [英] For performance, use one or several css files?

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

问题描述

我想知道是否最好为CSS文件创建一个或多个文件?

I'm wondering if it's better to make one or several files for CSS files ?

我总是看到有大量css文件的网站, href =http://developer.yahoo.com/performance/rules.html#num_http =nofollow noreferrer>似乎更好只使用一个大文件。

I always see websites with a plenty of css files, but it seems better to use only one large file.

你的建议是什么?

推荐答案

性能方面,你最好使用单个文件,在一个连接和请求到服务器(这些趋向于昂贵的操作,时间明智)。

Performance wise, you are better off with a single file, as it results in one connection and request to the server (these tend to be expensive operations, time wise).

这是为什么缩小框架存在,将每个页面的所有CSS(和JavaScript)文件合并在一起并在一个请求中提供。

This is why minifying frameworks exist, that merge together all the CSS (and JavaScript) files for each page and serve them in one request.

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

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