Site Navigation

Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

Tuesday, January 5, 2010

bug 396 - more style tag limits in IE

Issue: #396
Affects: IE6, IE7, IE8

Microsoft Support KB: 262161

You may already be aware that Internet Explorer has some limitations with the amount of CSS it can handle (bug 327) so that you can only load a CSS file up to ~288kb in size and the total number of CSS selectors/style rules can't exceed 4096 but there's more!

IE will also only allow you to have a maximum of 30 style tags on a page! So if you have a site that injects a lot of style tags on the fly for components/widgets you may want to think twice about this approach.

Run this code in IE and note that IE caps out at 30 and doesn't create the addition 70 stylesheet tags.


Example:
(note: this is IE specific code)

<html>
<head>
<script type="text/javascript">
function createStyleSheets(){
for(i=0;i<100;i++){
document.createStyleSheet();
var msg = 'Total Style Sheets = [<b>' + i + '</b>] of 100.';
document.getElementById('ssCount').innerHTML = msg;
}
}
</script>
</head>
<body onload="createStyleSheets();">
<div id="ssCount"></div>
</body>
</html>



How many style tags do you have on your page? Add this bookmarklet to your browser and find out. (note if you run it in IE and it says 30, you may well have hit the limit!)

# style tags


Known Workarounds: None.



Related Issues: (bug 327).


Bug/Site Feedback |
Submit a bug

Thursday, November 6, 2008

bug 327 - IE limits your CSS file size and contents!

Issue: #327
Affects: IE6, IE7, IE8

So like every Web Developer out there, you've moved all the styling you can to seperate CSS Stylesheets - Great!

Did you know that there are limits? Well no, not in all browsers however in IE there is a limit, in fact a few.

  1. In IE, the maximum size of any CSS file included in your page is ~288kb IE will load up to that point, but will ignore any content after that. (something to keep in mind if you merge your CSS files to avoid multiple HTTP connections!)

  2. In IE, you can only have 4096 style rules, after which all are ignored. (something to keep in mind if you are generating unique styles for nearly every element)




Known Workarounds: None.



Related Issues: None.

Bug/Site Feedback |
Submit a bug

Saturday, May 10, 2008

where are all the IE CSS bugs?

Issue: #450-???
Affects: IE6, IE7, IE8 Beta 1(some)

I received an emai1 {ThisSiteTitleWithNoSpaces@gmail.com} from Nelson T. recently asking where all the IE CSS bugs are? There are several of them, many even have their own name! However it makes much more sense for me to provide a link to better documentation and examples rather than try to re-invent the wheel.

I do have some CSS bugs to report that (I don't believe) are listed elsewhere though, and thus I plan to post those very shortly.

IE CSS Bugs:

The following collection is all available at:
Position Is Everything (PIE), complete with test cases and workarounds (where possible)





Bug/Site Feedback |
Submit a bug

Wednesday, April 16, 2008

bug 385 - valid CSS class names that fail in IE6

Issue: #385
Affects: IE6

In IE6, attempting to use a valid class name that starts with an underscore will fail.

Example:

<style type="text/css">
._myCSSClass {
/* This is a valid Class Name, but it will fail in IE6 */
border: 1px solid #ff0000;
margin: 1px;
padding: 3px;
}
</style>



Known Workarounds: None. The only option is to name all classes with an initial [a-zA-Z] character.

Example Workaround Code:

<style type="text/css">
.myCSSClass {
/* This is a valid Class Name, AND will work in IE6 */
border: 1px solid #00ff00;
margin: 1px;
padding: 3px;
}
</style>



Related Issues: None.

Bug/Site Feedback |
Submit a bug