Tuesday, 15 April 2008

Safari bug which causes all CSS to be ignored

Our QA dept. recently raised a bug on a project I was working on suggesting Safari was ignoring all my CSS. OK bit wierd... so I checked it out and they were right all the other browsers were fine but Safari was rendering a page without styles.

So off I go doing the ol' half and half trick (pulling out half the CSS refreshing then halfing that until you isolate the issue). Finally I track it down to the fact that I had deleted a hex value but the empty background-color element was still in the CSS along with a badly used !important - background-color: !important.

Just to prove I wasn't going mad here is the HTML to prove it. Hopefully it will help some poor sod out there who is currently refreshing Safari with a rather bemused look on their face...


div { font:20px arial; width:250px; height:250px; background-color:!important; }

#red { width:250px; height:250px; background-color:red; }

#blue { width:250px; height:250px; background-color:blue; }



<div id="red">
This is red

<div id="blue">
This is blue


(Oh and before anyone says it... you should never use !important but that's another story...)


Post a Comment

Subscribe to Post Comments [Atom]

<< Home