12-15-2007, 04:38 AM
|
#26 (permalink)
|
|
The Wanderer
Join Date: Dec 2007
Location: Indianapolis, Indiana, USA
Posts: 16
Thanks: 0
|
Quote:
Originally Posted by Dr John
You can fix a LOT of cross browser problems by declaring a full doctype. And then setting body {padding:0; margin:0;} (I see little to be gained by setting everything to 0, just more declarations you have to add to set things.)
Many older pages have no doctype of just half of one. Half a doctype can kick IE into quirks mode.
Use either of these (preferably strict)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
(There is nothing to be gained using XHTML as IE doesn't understand XHTML at all, and converts it to html.)
|
I have to agree with Dr. John.
Declaring your DOCTYPE will definitely help.
While each browser has it's issues, most try to follow the rules of the standard you declare. If you don't declare a DOCTYPE, then the browser has to guess which standard to follow or use a default standard. The problem is that all of the browsers have different systems in place for guessing the proper standard or use different default standard. So IE might default to HTML1.1 and FireFox might try to guess the best standard. Since the standards are so different, the same code is parsed differently. By declaring the DOCTYPE, the browsers should do a much better job of following the same rules. You'll still have some cross-compatibility issues but not nearly as many as you will if you don't declare your standard.
Give it a try sometime. Create an HTML/CSS document and don't declare a DOCTYPE. The use the exact same code and create a second file with the DOCTYPE declared. In almost every browser you use, you'll see a difference in the two documents even thought the HTML and CSS is the same. Go ahead and create three or four documents with the same content but declare a different DOCTYPE for each.
I'm really not a fan of using standards since no two browsers will follow all of the rules exactly the same way. Nonetheless, not specifying a standard will result in many more cross-compatibility issues than by specifying.
vujsa
__________________
Need PHP Help? - Handy PHP
|
|
|
|