Rob Cook
Joined: Dec 06, 1999
# Posts: 2007
|
Posted: 2006-Jan-02 21:51
Okay, I'm gonna come across like a right muppet here but here goes...
I've been designed websites (for myself) since 1999 and I have *NEVER* bothered to include a 'doc type' in the HTML. Never needed to and didn't see why I should bother when my sites worked fine in all browsers I tried and the search engines didn't seem to mind either.
Anyway. Reading stuff in various forums, it seems there is more and more encouragement to specify the doc type. So... I've decided to give it a try on one site (the one in my profile).
Thing is, I've done a bit of reading and can't work out exactly which doc type I should enter. Any ideas? I just use very basic design in HTML - no CSS or XHTML or anything like that. Works for me
|
 |
encryptdesigns
Joined: Jul 15, 2005
# Posts: 22
|
Posted: 2006-Jan-02 23:28
Take a look here:
http://www.w3.org/QA/2002/04/Web-Quality
There are some nice examples on which doctype to use for certain scenarios. Hopefully that helps...
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2006-Jan-03 00:56
If you don't know which you need then opt for HTML 4.01 Transational to begin with. It is the "most common" and the most forgiving of errors.
If you get serious with validation then you might want to move up to HTML 4.01 Strict later.
Older standards, like HTML 3.2 and earlier, are severely lacking in features, and should be avoided now.
The full DOCTYPE (for HTML 4 onwards) includes a w3c.org URL within it, and that triggers "standards mode" in modern browsers (and you need to be aware of "box model" implications in IE {non standard behaviour} when you start doing that).
There are serious issues with XHTML and validation, and with MIME types and browsers (especially IE) that put me off using XHTML for the forseeable future. XHTML also removes many tags and attributes from the specification (compared to HTML 4, that is), forcing you to use other methods.
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2006-Jan-03 01:03
No CSS?
I am going to recommend that you strip out all your <font> tags and replace them with 10 lines of CSS in an external file - one file that every page of the site can access.
It unbloats code, makes updates so much easier, and is just easier to work with.
You need to make sure that your pages consist of headings, paragraphs, lists, tables, and forms; that all tags are closed; the pages validate as much as possible; and you have a DOCTYPE on the first line.
|
 |
Rob Cook
Joined: Dec 06, 1999
# Posts: 2007
|
Posted: 2006-Jan-03 01:50
Thanks for all the feedback to date. I'm going to do a little bit more reading (only a bit mind, I'm a lazy sod) and see if I can work out the correct format for specifying the doctype for this site...
|
 |
Rob Cook
Joined: Dec 06, 1999
# Posts: 2007
|
Posted: 2006-Jan-03 01:50
BTW, is every page supposed to have a doctype specified or just the site's index page?
|
 |
Rob Cook
Joined: Dec 06, 1999
# Posts: 2007
|
Posted: 2006-Jan-03 01:59
Well, I've stuck in the doctype now - I think I've found the correct formatting...
Incidentally, I've just tried to validate the pages at w3.org but didn't get far at all. I got the following error:
"Sorry, I am unable to validate this document because on line 6 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication."
That's kinda weird because line 6 is just a meta tag!
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2006-Jan-03 02:02
Then it has a non valid character in it. Fix that one!
Use this version of the validator for extra options: http://validator.w3.org/detailed.html
The DOCTYPE goes on every page of the site. Make sure too that every page has a "character set" meta tag and that each title tag and each meta description is unique per page.
|
 |
Rob Cook
Joined: Dec 06, 1999
# Posts: 2007
|
Posted: 2006-Jan-03 02:09
Hmmm.... just tried an alternative validator (htmlvalidator.com) and it said zero errors. There are no non-standard characters there...
What's puzzling me - and stopping me from putting the doctype on all pages for now - is that by adding the DOCTYPE to the index page, it appears to have screwed up all the text horizontal alignment from left to centre.
Goddam - wish I hadn't started this :/
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2006-Jan-03 02:28
There IS a non-valid character there.
Stuff like Microsoft Smart Quotes (the ones that curl in, for example) are not allowed, as well as several others that FP spits out.
Your site will be much better off for fixing it all though... once you can validate the code, you'll find the cause of the mis-alignment soon enough.
|
 |
Rob Cook
Joined: Dec 06, 1999
# Posts: 2007
|
Posted: 2006-Jan-03 03:31
I'll confess that I'm lost then. According the the validator, the non-valid character(s) is in line 5 (not 6).
Line 5, as far as I can see, simply is:
<TITLE>UK Casino Times. The Guide For UK Casino Players</TITLE>
There's nothing invalid there as far as I'm concerned. Unless anyone can tell me different?
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2006-Jan-04 00:36
In the W3C validator options, temporarily change the "Chararacter Encoding" settings to "ISO-8859-1" to at least let the validator check the page. This doesn't alter anything on your site, just lets the validator get to work.
I just looked at your index page, and there are several things there that can be tidied in your code. Read all my earlier threads for lots more info. Your HTML code has this 1998 retro feel to it. I kept hearing myself say "I wouldn't do it like that". Lots of things could be improved
|
 |
Rob Cook
Joined: Dec 06, 1999
# Posts: 2007
|
Posted: 2006-Jan-04 02:49
"Your HTML code has this 1998 retro feel to it."
So very true
|
 |
seekz
Joined: Jan 11, 2006
# Posts: 19
|
Posted: 2006-Jan-12 20:01
I am strongly in favour of Strict XHTML. If you search for the term "quirks mode" then you will see why.
If you are not using XHTML and CSS then don't bother using a DOCTYPE.
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2006-Jan-12 22:03
Have to disagree with that. Every page should have a DOCTYPE.
|
 |
Curt
Joined: Eons Ago
# Posts: 3736
|
Posted: 2006-Apr-08 12:15
Why use doctype if sites show up OK in the browsers and get indexed by the engines?
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2006-Apr-08 18:48
It tells the browser what sort of code to expect.
Lets it get on with its job rightaway instead of having to make a guess.
|
 |