有没有在CSS文件的大小限制任何? [英] is there any limit on css file size?

查看:101
本文介绍了有没有在CSS文件的大小限制任何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET MVC开发一个网站。 CSS文件已经成长为88KB,并具有多一点5000行。最近,我注意到,风格在末尾添加不存在的浏览器。是否有CSS文件或行数?

I am using ASP.NET MVC to develop a site. The CSS file has grown to 88KB and is having a little more 5,000 lines. I noticed recently that styles added at the end are not there in the browser. Is there any size limit on CSS file or on the number of lines?

修改
对不起,我忘了提,这个问题在Windows 7无论是在FireFox和IE8的发生。

EDIT: Sorry I forgot to mention that this problem is occurring in Windows 7 both in FireFox and IE8.

推荐答案

我认为,如果你有与你的CSS文件的大小问题,那么现在是时候为重新考虑你的造型策略。 CSS中的C代表级联。很多时候,当CSS文件得到太大是由于款式不是再酌情使用,并通过使用差级联行为。

I think that if you are having problems with the size of your css files then it is time to rethink your styling strategy. The C in CSS stands for cascading. Quite often when CSS files get too big it is due to styles not being re-used where appropriate and through poor use of the cascading behaviour.

我不轻易说这个。我曾在一些大型的,复杂的零售网站工作,目前在非常复杂的金融交易应用。每当我来翻过网站有超过几百个款式,我们通过减少复杂的CSS实现了设计大的改进,复杂性和可维护性的改进减少。

I don't say this lightly. I have worked on some large, complex retail sites and currently on very complicated financial trading applications. Whenever I have come accross sites with more than a few hundred styles, we have achieved large improvements in design, reductions in complexity and improvement of maintainability by reducing css complexity.

一个地方,开始做一个谷歌sesarch上的 CSS重置即可。有多种不同的实现,但它们一般遵循覆盖布局的差异为每一个浏览器和删除任意边框,边距和填充等用干净的石板开始,如果你愿意的主题。然后你就可以继续前进,从那里建立起自己的风格,注意充分利用级联 CSS链接

One place to start is doing a Google sesarch on css reset. There are multiple different implementations, but they generally follow the theme of overriding the differences in layout for each of the browsers and removing arbitrary borders, margins and padding etc. Starting with a clean slate, if you will. Then you can go ahead and build up your styles from there, being careful to make the most of cascading and css chaining

链接就是你有一个元素多个类。例如:

Chaining is where you have more than one class on an element. eg:

<div class="box right small"></div>  

可能有你可能想适用于许多块元素,如DIV,H1 ... H6,P,UL,李,表中的一些通用风格,块引用,pre,形式。 是自我解释右键可能只是靠右对齐,但与4PX的右填充。随你。问题的关键是,你可以有多个类每个元素,并建立可重复使用的积木造型 - 个人风格设置分组。否则,被称为类。

box might have some general styles that you might like to apply to many block elements such as div, h1...h6, p, ul, li, table, blockquote, pre, form. small is self explanatory right might simply be aligned to the right, but with a right padding of 4px. Whatever. The point is that you can have multiple classes per element and build up the styling from reusable building blocks - groupings of individual style settings. Otherwise known as classes.

在一个非常简单的水平,寻找oportunities到风格结合起来:

On a very simple level, look for oportunities to combine styles:

这样:

h1 {font-family: tahoma, color:#333333; font-size:1.4em;}  
h2 {font-family: tahoma, color:#333333; font-size:1.2em;}  
h3 {font-family: tahoma, color:#333333; font-size:1.0em;}  

变为

h1, h2, h3 {font-family: tahoma, color: #333}  
h1 {font-size:1.4em;}  
h2 {font-size:1.2em;}  
h3 {font-size:1.0em;}  

只是,略小,但做这种事情很多次的,你可以有所作为。

Only, slightly smaller, but do this kind of thing lots of times and you can make a difference.

此外,验证你的CSS 。这将帮助你在你的code发现错误。

Also, Validate your css. This will help you spot errors in your code.

这篇关于有没有在CSS文件的大小限制任何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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