is there any limit on css file size?

前端 未结 11 1990
Happy的楠姐
Happy的楠姐 2020-12-09 19:18

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 the

11条回答
  •  离开以前
    2020-12-09 20:13

    Your question is:

    Is there any size limit on CSS file or on the number of lines?

    The answer, for IE9 and lower, is yes, depending on what you mean by "lines" and "size limit".

    1. Size: the max size style sheet that IE9 and less will read is 288kb. Any styles after that mark do NOT get read. Read this article by Joshua Perina for a little more info on this.
    2. There is no max on the number of lines in a style sheet that I'm aware of. There is a max on the number of selectors. IE9 and lower stops reading (and may not even load a file, that info seems to be up in the air) at 4095 selectors per style sheet. (see linked article below)
    3. If by "lines" you mean how many lines of @import linked style sheets you can add per file, you can have 31 max style sheets imported in. Each stylesheet can have 31 max @imported style sheets. (see linked article below)
    4. @import nesting supports up to 4 levels deep.

    This article on MSDN talks a little more about the max selector and linked style sheets, and how they came to those numbers when developing IE.

提交回复
热议问题