Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

opera not recognising CSS stylesheet



7:02 pm on Aug 4, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

got a real annoying problem that i've only just discovered. if i view my site in opera it appears as a totally unstyled page, as if there is no stylesheet at all.

every other browser i've tried (firefox, IE, chrome, safari) is fine. and the stylesheet is definitely there. i can even link to the stylesheet in opera and get it to display all the rules. it just won't act on them.

the only thing that i can think of is the fact that it has a .php extension rather than .css.
but it's served with the correct header and mime-type is okay, and every other browser recognises it okay, so i can't see why that would be an issue.

i'm stumped. anyone had any similar problems with opera?


2:05 am on Aug 6, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Has both the page and css ben run thru a validator? Opera is very strict in its standards interpretation. Does the link to the stylsheet have media="screen" rel="stylesheet" type="text/css ?

Is the page and css both served as the same type (ANSI/UTF-8)?

Beyond this a wild guess of what might help, have a look at Dynamic Cascading Style Sheets [en.wikipedia.org ]


2:14 am on Aug 6, 2010 (gmt 0)

10+ Year Member

The only times I have problems with opera stylesheets using php is when the server header is incorrect. Is the header set as Content-type: text/css?


1:53 am on Aug 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

+1 to outrun's suggestion. Worth a check IMHO.


8:39 am on Aug 7, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

this is what i've got at the top of the php (css) file

header("Content-type: text/css; charset:UTF-8");

and when i look at the response headers it says
Content-Type: text/css;charset: UTF-8

so that looks alright

this is how i call it from the html
<link rel="stylesheet" type="text/css" media="all" href="example.php">

cant see anything wrong with that


7:22 am on Aug 12, 2010 (gmt 0)

5+ Year Member

Are you sure the stylesheet is really encoded with utf8 ? No BOMs at the beginning of it or some such? Are you sure no other data is output first? Do you have a link I can look at?

Featured Threads

Hot Threads This Week

Hot Threads This Month