View Full Version : DOCTYPE Disaster.
puffnstuff
02-22-2007, 04:54 PM
I have created a website with several pages. There is a combination of HTML, a little JavaScript, and an external CSS style sheet. Currently, NONE of the pages have a DTD statement at the top.....and everything works fine (I think).
However, in reading many sites, I am under the impression that each page MUST have a DOCTYPE statement. So, I attempted to add the one that was most recommended:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
This gave disastrous results, with images disappearing everwhere. I tried other versions of DTD's, like 4.01 strict, and some of the text colors defined in my CSS disappeared! What's going on? How do I know which DTD is the right one?
BLiZZaRD
02-22-2007, 05:03 PM
When you do not have a DOCTYPE, the browser goes into quirks mode, and basically this is what is screwing up.
If you validate you pages (http://validator.w3.org/) You will see the errors, where they are and can fix them.
Once the page is valid you should notice that it looks great.
You can also validate your CSS there :)
puffnstuff
02-22-2007, 06:38 PM
So.....which DOCTYPE should I be using? I have seen so many different ones, and I don't really know which one is right.
The pages all display and behave properly WITHOUT a doctype. But as soon as I add any sort of doctype declaration, the whole site goes haywire.
And I can't validate the pages without the doctype.
jscheuer1
02-22-2007, 06:53 PM
You don't need a DOCTYPE but one day (in a universe far far away) you may. However, if you are just starting out, a strict HTML 4.01 DOCTYPE is the way to go:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
You may think your page looks OK without it and without validation but, that is probably just in one version of one browser (the one that you check your work in). To code effectively with no DOCTYPE across browsers is actually a more advanced technique than using the strict DOCTYPE and can have certain advantages. Coding with no DOCTYPE for only one browser is easy but, then your pages must be viewed in that one browser.
BLiZZaRD
02-22-2007, 08:00 PM
Agreed.
Also, if you are just starting out you can use the transitional doctype to get your page up and viewable.
Then force the validation to check as strict, fix those errors then switch to Strict when it all works right.
As John says, you can get away with none right now, but probably not for very much longer.
Also, if you are just starting out you can use the transitional doctype to get your page up and viewable.Not a good idea -- you might use (and possibly hinge your design on) something that has no Strict equivalent.
BLiZZaRD
02-22-2007, 11:29 PM
No, but for someone that is learning, and going from no doctype, using the more forgivable trans type will give them something to look at while they adjust.
I know for me it really helps. I have had pages act just the way the OP describes, couldn't get it for the life of me. But then putting it in trans first I could see the spots in question.
Making the move to strict was simplified going from trans type than from no type at all.
puffnstuff
02-23-2007, 08:45 PM
Thanks for your sage advice. I have managed to (so far, I think....LOL) put in a Transitional DTD, that does not bugger up the page layouts.
One more question: (Perhaps this should be a new thread?)
Why is it that when I do a google search on keywords within the site (words that are text on the main page), as well as keywords that have been placed in the meta name "keywords" statement, the page never comes up on google? What do I have to do to make it detectable by various search engines? Can you tell I'm really really green at this?:D
puffnstuff
02-23-2007, 08:48 PM
At first I thought the lack of search engine success was due to the complete lack of DTD. But now that I have the DTD in there, it's still not coming up with a google search. So what else am I missing, here?
Tristan S.S.
02-23-2007, 08:50 PM
Hey Hey!
Visit this page and submit you site to google's engine, that should fix your problem, however it does take some time to be indexed by google, sometimes weeks, sometimes months!
http://www.google.com/addurl/
BLiZZaRD
02-23-2007, 09:24 PM
Google, yahoo, ask and a few others send out their bots every 2 weeks, they will index your site and update within every 4 weeks. Then after it is initially indexed it will be updated every2.
Meta tags are now being ignored by the larger engines, instead they are looking for nice sites (no malicious codes/reports/etc.) as well as the number of other sites that link to you.
the addurl thing is nice, but all it does is add your site to the current bot's list of indices's, it does nothing to speed up your indexing.
If you want a boost in google's response time sign up for an account and go here (https://www.google.com/accounts/ManageAccount) Once there, you can make google look at your site, create a site map and tons of other management aspects. Including how often your site is indexed.
puffnstuff
02-23-2007, 09:57 PM
AHA! Very good stuff to know. I will definitely be doing all of that this weekend. Then hopefully in about a month's time, I'll be able to search on some key phrases, and the site should pop up. Right?
Thanks again. This is a very informative site, and your advice is much appreciated. :) :) :)
BLiZZaRD
02-23-2007, 10:00 PM
Should, yes. :D
And you are welcome. Don't worry though... give it about 6 months or so and you will have given up all care for the Google rankings on your site... believe me, it wears thin and you find more important matters to worry about. :D
puffnstuff
02-24-2007, 03:34 AM
It's not me, it's my boss (owner of the company).....HE wants to make sure that potential clients who are searching for the particular products and services we offer, will be able to find our website.;)
BLiZZaRD
02-24-2007, 03:19 PM
Tell him "I will do what I can sir, but ultimately that option is out of my hands. However, if you put good content on the site and don't try to scam these poor *******s out of their rent money, we will get visitors."
Either you will get fired, or get a raise :D
auntnini
02-24-2007, 11:01 PM
A good starting point for DTD info is http://www.w3.org/TR/html4/sgml/dtd.html Where it mentions different DTDs "strict.dtd" "loose.dtd" "frameset.dtd" "HTMLlat1.ent" "HTMLsymbol.ent" "HTMLspecial.ent"
For instance (God forbid), you are still using <frameset>, -- Typical usage would be:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html> <head> ... </head>
<frameset> ... </frameset> </html>
Without a proper DTD at top of page (telling browser how to parse page), the page is rendered in "quirks mode." Question then arises, is the coding "QUIRKY"? ... using deprecated <font> tags, not closing <p>...</p> tags, improper nesting of <b><i>tags</i></b>, and so forth? If you decalre DTD for XHTML, be sure you use proper coding variations for XHTML tags (e.g., close <br /> and <img />). XHTML is a move toward XML. DTDs are essential in future world of XML.
SEARCH ... repeat and give prominant positioning of key words in <title>__</title>, <meta name="description" content="_"> and <meta name="keywords" content="__,__,__,__">, and at very top of page in <BODY> text and image/alt, etc. For meta tags, think of possible spelling and search-word variations. Then get as many hits and links-to site as possible from friends. Finally, face it: there's a lot of competition out there. I've been trying (without success) to get a portrait painter to come up under "portraits" by using "portrait paintings by Chanit" for http://www.chanit.com.
If you decalre DTD for XHTML, be sure you use proper coding variations for XHTML tags (e.g., close <br /> and <img />).Don't do this, for the reasons I've said above, unless you're willing to drop support for IE.
DTDs are essential in future world of XML.Unlikely. XML Schema is beginning to replace them.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.