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?
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.
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.
BTW, the "Important" threads at the top of this forum section are also good reading on the subject.
Thank you guys. Explanations that don't start somewhere above my head and a real-world example, just what I was after.
This topic is now closed. New replies are no longer allowed.