View Full Version : Doctype!


midorino
08-12-2006, 08:52 AM
Hello.
I'm a pretty messed-up maker of messed-up websites... and doctype is one of the things that's killing me.
You see, it's easy to say "just pick the one that's appropriate for your site".
-That's exactly what I don't know.

I do believe I'm writing in HTMl as opposed to XHTML, since I learned everything I did on this website, but as to its version - no clue.

I was working on another problem, and I noticed that it only looked the way I wanted it to with no DTD at all. (I'm using IE.)

I fooled around, and when I chose the HTML 3.2 or something, it showed up all right at last.
But when I validated the page, it wouldn't even allow me to use "type" attributes.

So, I wonder, how do I know which DTD is right for me, when I don't even know in what 'language' I'm writing?

(BTW, the little problem I was talking about involved unwanted horizontal scroll bars and can be seen in the 'frames' section.)

bourdelson
08-12-2006, 04:23 PM
Well, it seems that not knowing what version of HTML you are using would kind of negate the point of validation.

However, the type property should validate in 3.2, because that's when it was defined. [see here (http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/type_7.asp).]

My suggestion is to forego the validation this time around, and the next time you code your webpage, if validation means that much to you, follow w3c's standards.

J to the izzosh
08-12-2006, 07:23 PM
Also, it's best not to try to figure out in which language it is that you're writing by arbitrarily picking document type definitions until all of your elements and attributes are allowed. Indeed, you should simply choose the newest versions of the language - I'd recommend XHTML 1.0 Strict unless you're using frames, then XHTML 1.1 once you've become more familiar with DTDs - and force yourself to write within its bounds. This way you will be guaranteed to be using the most up-to-date methods and standards. If you are told that an element doesn't belong, then chances are it doesn't and you will have to remove it and use a proper method, but before deleting any code, make sure that your syntax validates (lowercase tags and attributes, attribute values encased in double quotes, open and close every element - even empty ones like <img>and <link> by putting a foreslash at their ends (<img />) - have only one <html>, <head>, <body>. and <title> element, etc. Bad syntax can throw back a lot of errors that aren't actually there because if your syntax is off in one section of your page, then it can throw it off in the rest of your page.

When using (X)HTML, all of your styling and positioning should be done only with CSS. If you cannot acheive the layout you desire merely by correcting errors, then you may simply have to re-write your page. Remain open to the fact that things may just have been done wrong from the start, especially if you've been using IE since it tends to encourage many bad and false habits.

midorino
08-14-2006, 01:18 PM
Uh, well, I guess I'll just let the browsers slip into quirk mode and let them do the thinking... ;)
Thanks anyway, I s'ppose I'll have to relearn HTML some day.