treacle0996 — 2011-05-14T03:48:11-04:00 — #1
I am really confused about what effect different doctypes have.
STRICT means no inline styling?
You need FRAMESET if you want to use frames?
But what is the difference between using
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
What will work, or won't ?
What is best practice?
xhtmlcoder — 2011-05-14T04:17:10-04:00 — #2
The first is XHTML 1.0 the second is HTML 4.01 so if you are writing HTML chose the second one or better still use Strict grammar rather than Transitional.
paulob — 2011-05-14T04:21:44-04:00 — #3
earlyout — 2011-05-14T07:23:39-04:00 — #4
Just to add to the joy of the subject, there's a world of difference between what's allowed with a given DOCTYPE, and what will actually work in a browser. Just a quick example: in the Strict DOCTYPES, you can't use a <center> tag. If you do, the page will fail to validate as "proper" HTML. Yet pretty much every browser will, in fact, center the material between those tags, DOCTYPE be damned.
"Strict" does not mean "no inline styles." It means, among other things, that styling (generally, with some exceptions for tables, for example) uses CSS, not HTML attributes or tags. So, this is OK in a Strict page:
<span style="color: red;">Red text</span>
But this isn't kosher:
<font color="red">Red text</font>
But again, either one will produce red text in any browser. Go figure.
My two cents: coding for "Strict" and validating your pages against a Strict DOCTYPE probably gives you the best chance of having your stuff render properly in all browsers, and gives you some future-proofing.
earlyout — 2011-05-14T07:50:23-04:00 — #5
BTW, the "Important" threads at the top of this forum section are also good reading on the subject.
treacle0996 — 2011-05-16T13:29:33-04:00 — #6
Thank you guys. Explanations that don't start somewhere above my head and a real-world example, just what I was after.