IE CSS文件限制

doc.createStyleSheet() invalid argument exception

 

Internet Explorer (IE for short) imposes some CSS file limitations that may directly affect page rendering. Below is a list of known CSS file limitations still found in IE version 9 and earlier.

- Up to 31 CSS files or <style> tags per page.
- Up to 288K per CSS file (uncompressed).
- Up to 4095 selectors per CSS file.

If a page exceeds the first limit, it fails loading all the required CSS files. Once a CSS file hits the second or third limit, any additional style in the file will be ignored.

Resource merging, which help you reduce the number of requests made to the server, may bring the following dilemma in IE. If you are not using resource merging, you can pretty easily hit the first limit. On the other hand, if resource merging is enabled you may eventually hit the other two limits. So, to avoid hitting the limits, we recommend that you enable or disable resource merging based on the CSS file structure you are using.

Currently, the solution to automatically manage our CSS files in order to keep them within the limits is not ready yet. We created a corresponding suggestion in our Support Center (Suggestion ID: S35991, In IE, automatically split CSS resources if their size exceeds 288K) so that you can track our progress on it.

The first limitation usually occurs when the <head> tag contains several <link> and <style> tags. A number of linked styles to the page can be got via the document.styleSheets.length property in the JavaScript console. Using the document.styleSheets collection, you will be able to determine what styles are linked to a specific page (e.g. use the FireBug console).

 

 

http://msdn.microsoft.com/en-us/library/ms531194%28VS.85%29.aspx

Resource Merging http://documentation.devexpress.com/#AspNet/CustomDocument6911

posted on 2011-08-14 09:54  Peter Zhang  阅读(912)  评论(0编辑  收藏  举报