How Opera deals with trying to import non existent CSS files
We happened upon a very interesting Opera quirk at work today!
A developer decided to add an @import link to a non-existent CSS file that would be included at a later date. During testing we saw some interesting results with the page rendering, things being positioned in the wrong place etc.
So, turning on Operas very nice Developer Console, we looked to see what was happening. Opera showed the CSS files it was asked to link to and there was the link to the non-existent file. However, when we clicked on the show rules button we saw some unexpected results!
We would have expected to see nothing, but instead we saw some CSS rules. These rules were coming from the Apache custom 404 page, which has some CSS in the head!
It seems that Opera, looking for a file (with content type text/css), received a 404 page which contained some text/css content which it applied to the page!
This seems like very odd behaviour. The W3C has no specification or recommendation on what user agents should do in the case of a linked CSS file not being present. IE and Firefox/Mozilla do nothing and accept the omission, Opera seems to be far more hungry with it’s search for some CSS to pull in!
Now, I know that it is bad practise to try to link/import files which don’t exist but is Opera doing the right thing here? Opera is excellent for standards adherence and forces us to be very exact with our code, but surely looking at the HTTP response, seeing 404 instead of 200, should have meant that it didn’t try to seek for some, any CSS!

By Rijk on 31 May 2007
Hi Rijk,
Thanks for the reply!
I don’t think that it’s a bug in the Developer Console, as the CSS (from the 404) it’s showing is the same (with shorthand rules expanded to their verbose form) and the effect that they are having on the page is in keeping with the CSS rules.
Loggin that bug report now!
Cheers!
Alex
By Alex Horstmann on 01 Jun 2007
I also posted this for discussion at http://www.webmasterworld.com, in the Opera Browser discussion forum.
We got a response there from an Opera emplyee who tells us that “According to QA, this has most likely been fixed for “kestrel” (next major release of Opera)”.
Good news!
By Alex Horstmann on 06 Jun 2007