Server errors with @import from within a style sheet

by Mike Badgley on June 11, 2009

Came across this one yesterday after we launched a new Sitefinity-powered Web site for a client of ours. We were getting all sorts of HTTP Error 400 Bad Request errors, and they all had to do with style sheets. The site appeared fine in all browsers we tested in, so it was a bit puzzling why this was happening.

The issue? For some reason, the server was complaining about the method I was using for importing my style sheets. Within my global/base style sheet, I import a series of external style sheets based on various media types. The method I used was:

@import “stylesheet.css” mediatype;

It’s always seemed to work in the past and this is the first time we’ve come across a server error because of it. The solution? I imported the style sheets using a slightly different, and that seemed to do the trick:

@import url(stylesheet.css) mediatype;