一个巨大的CSS - 或许多小的? [英] One massive CSS - or lots of little ones?

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

问题描述

有希望的简单问题。



我们有一个超过3000行的样式表,当页面渲染结果时,有一个明显的滞后。 p>

这里有一个问题:最好有一个巨大的样式表覆盖一切,或许多小的样式表覆盖不同的页面部分? (例如一个用于布局,一个用于下拉菜单,一个用于颜色等)



这只是为了性能而不是真的 '

解决方案

好吧,如果你将这3k行分成多个文件,整体呈现时间不会减少,因为


  1. 所有3000行仍需要解析

  2. 需要多个请求才能获取CSS


的文件

Simple question hopefully.

We have a style sheet that is over 3000 lines long and there is a noticeable lag when the page is rendering as a result.

Here's the question: Is it better to have one massive style sheet that covers everything, or lots of little style sheets that cover different parts of the page? (eg one for layout, one for maybe the drop down menu, one for colours etc?)

This is for performance only, not really 'which is easier'

解决方案

Well, if you split those 3k lines into multiple files the overall rendering time won't decrease because

  1. All 3000 lines will still need to be parsed
  2. Multiple requests are needed to get the CSS files which slows down the whole issue on another level

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

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