View Full Version : First Post!! (and DTDs)
Yeah!
I mean, how about those elections, then?
--
On topic, DTDs. Document Type Declarations.
I've only been developing with them for the second half of this year, but I'm finding more and more sites on the net that don't have them. I generally use XHTML 1.0 Strict (http://www.w3.org/TR/xhtml1/), but there are some who swear by HTML 4.01 (http://www.w3.org/TR/REC-html40/). Is there a reason for this? There is little difference between the two aside from having to add a closing slash to any non-wrapping elements (eg, <br /> and <link blah /> ), and also that XHTML is valid XML. Since XHTML is newer, I'm not sure why people continue to develop with HTML.
Discuss?
BlueBoy
11-10-2004, 12:57 PM
I prefer XHTML 1.0 Transitional myself. Though I'm sure I'll move to Strict one day.
What's worse than people using HTML 4.0 is people that don't even declare a doctype. There's really not that much extra work involved in it. Plus you get teh added bonus of being able to validate it!
hazza
11-10-2004, 10:09 PM
xhtml is being taught at our uni as the 'standard' for webpage developement, but really does the doctype declaration do much anyway?
As far as it's been explained to me, and I'm sure BlueBoy could tell you more (and be right while telling it), a doctype identifies the code on your page as conforming to an agreed specification. Without a doctype, the browser goes into 'quirks mode', and just renders it as a 'best guess'. This means different behaviour across different browsers, and non-standard rendering of elements on a page.
Of course, with a number of browsers out there today (WinIE 5.x and 6.x being the major culprits) don't conform to some specifications anyway, even when the doctype is declared (for example, it's recommended that instead of enclosing paragraph text that's a quote within " ", you instead use <q> </q>. At last glance (and it's been a while since I heard about this), WinIE 6.x still doesn't support <q> tags, despite the fact that they've been around for a long time. Similar issues arise with CSS - different browsers render stuff differently.
In any case, the argument for doctypes (and conforming code) is for standardisation: that is, this element does this thing and should be rendered this way. If all browsers conformed to specifications, then you could be confident that the XHTML or HTML code that your write will be valid and hopefully look the same in all browsers.
Uther Pendragon
12-10-2004, 12:19 AM
I am a big fan of doing initial development using firefox, using that web toolbar is gold, plus the javascript error console is teh rox0r. Then once I am finished (and it is pretty standards compliant) I fire it up in IE and see what shit is broken, then you start with the work arounds, goddamn I hate IE's shitty css support, it blows so hard.
I use dreamweaver.... what is the DTD you speak of?
Shit dude, I actually wrote a whole post getting abusive at how joke replies aren't tolerated here, and how it's people like you it's all fucked up, etc. I'm sorry, I really am.
To the topic:
I've explained briefly what a DTD is in my other posts, and as far as I know Dreamweaver defaults to HTML 4.01 Transitional (it's been a while since I've used it). As stated above, a Document Type Declaration simply tells the browser (declares) what all of the stuff in a given file means (document type). DTDs give the browser information on what a <p> tag means as opposed to an <h1> tag. It tells the browser what sort of things are legal properties of an <img> tag. There is some excellent information at the w3c website, linked to from my first post.
BlueBoy
12-10-2004, 11:19 AM
As far as it's been explained to me, and I'm sure BlueBoy could tell you more (and be right while telling it), a doctype identifies the code on your page as conforming to an agreed specification. Without a doctype, the browser goes into 'quirks mode', and just renders it as a 'best guess'. This means different behaviour across different browsers, and non-standard rendering of elements on a page.
Of course, with a number of browsers out there today (WinIE 5.x and 6.x being the major culprits) don't conform to some specifications anyway, even when the doctype is declared (for example, it's recommended that instead of enclosing paragraph text that's a quote within " ", you instead use <q> </q>. At last glance (and it's been a while since I heard about this), WinIE 6.x still doesn't support <q> tags, despite the fact that they've been around for a long time. Similar issues arise with CSS - different browsers render stuff differently.
In any case, the argument for doctypes (and conforming code) is for standardisation: that is, this element does this thing and should be rendered this way. If all browsers conformed to specifications, then you could be confident that the XHTML or HTML code that your write will be valid and hopefully look the same in all browsers.
Actually I think you've explained it pretty well.
The problem with the standardisation is that although they've been agreed on, no one an actually enforce them. That's why you get companies like Microsoft, who were part of the orginal W3C lineup, that decide to go their own way.
Hell, up until recently the Microsft website didn't even declare a doctype!
Kez - Hit F10 in Dreamweaver to get a look at the code. You'll be able to see the doctype declaration up the top.
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.