CSS style lost on validation in ASP.NET, ie only

In the process of upgrading the style of an existing ASP.NET web application I incorporated the 960.gs grid system style sheets. Along the way I created a single style sheet with 4 @import directives, so I didn’t have this list of CSS files on every page, just one <link href…> tag that included a single CSS file with the @imports.
During testing it was uncovered that while using the app in IE 7, when a validator failed and generated a message (like “Bad email address” etc) during the postback process a large majority of the style on the page would be absent – making it look pretty bad.
Turns out the problem is the @import directives not being obeyed during the 2nd rendering of the page.
I moved all the CSS into a single file (which will help with performance in the long run) and the problem goes away.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s