Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a "CSS Reset" necessary for cross-browser CSS?

I've been trying to come up with a decent cross-browser CSS framework for my next project, because my last one had a whole bunch of PHP/CSS hacks (horrible things like class="blah<?=isIe()?>"). I'd like to do it "right". I've looked at this question, which did not get a lot of interest, so I'd like to narrow this down: is a CSS reset necessary for cross-browser formatting? What about the Doctype? Should one use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

or what? Also, does anybody have any insight into the usefulness of Blueprint?

like image 657
Dan Rosenstark Avatar asked Oct 19 '09 13:10

Dan Rosenstark


2 Answers

A CSS Reset isn't needed, but it does simplify things.

A Doctype is needed, without one browsers will enter Quirks mode and you open a big box of inconsistencies. The HTML 4.01 Strict Doctype you mention is a good choice, it is the most modern version of HTML that has decent support in the market.

like image 176
Quentin Avatar answered Sep 28 '22 10:09

Quentin


A CSS reset isn't necessary, but it definitely helps a lot. It will make it so all elements are rendered the same in all browsers.

There are still certain things that will be slightly different due to each browser (mainly IE) rendering the box model differently. There are easier ways of doing browser specific CSS that inline class changes though. You can create an IE specific style sheet and just override the specific things you need changed. You don't need PHP for this either.

<!--[if IE 6]>
    <link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]-->

You can can also use "lt" for < and "gt" for >.

<!--[if lt IE 7]>
    <link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]-->

For me, doing a CSS reset has fixed 99% of my issues.

Yahoo has a nice one. http://developer.yahoo.com/yui/3/cssreset

like image 31
Josh Close Avatar answered Sep 28 '22 11:09

Josh Close