Web Hosting Talk







View Full Version : HTML DOCTYPE?


bambinou
03-13-2010, 08:47 AM
Hi all,


I am having a problem with my documents doctypes, my programmers have in the past programmed the site and I now believe it is full of problems,

I am trying to resolve them slowly on my own...hard job.

First,on one of my page, the html markup checker says:
No DOCTYPE found! Checking with default XHTML 1.0 Transitional Document Type.

No DOCTYPE Declaration could be found or recognized in this document. This generally means that the document is not declaring its Document Type at the top. It can also mean that the DOCTYPE declaration contains a spelling error, or that it is not using the correct syntax.

The document was checked using a default "fallback" Document Type Definition that closely resembles “XHTML 1.0 Transitional”.




On the top of my page there is this:

<html xmlns="http://www.w3.org/1999/xhtml">


What is wrong with this?

I am still lost with the doctypes and do not really understand what it is or what it is for,i checked out the tutorials but still cannot get it :-)


Thanks for letting me know

Driver01
03-13-2010, 08:55 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Add this to the top above what you have already, this will give your document the xHTML Transitional doctype.

Basically you have to declare to the client what sort of document you are serving it, is it HTML, xHTML, RSS etc..to allow the client to parse it as intended.

bear
03-13-2010, 08:55 AM
*Moved to web design and content, as HTML isn't programming.*

See here: http://www.w3schools.com/tags/tag_DOCTYPE.asp

bambinou
03-13-2010, 09:12 AM
Thanks Driver01,

Now I have a new problem, I have this code:

<script type="text/javascript"
src="http://www.statcounter.com/counter/counter.js"></script><noscript><div
class="statcounter"><a title="blogger counters"
href="http://www.statcounter.com/blogger/"
target="_blank"><img class="statcounter"
src="http://c.statcounter.com/46546556464/0/7505d9ba/1/"
alt="blogger counters" ></a></div></noscript>


the html markup checker says:

# Error Line 44, Column 28: end tag for "img" omitted, but OMITTAG NO was specified

alt="blogger counters" ></a></div></noscript>



You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
# Info Line 42, Column 17: start tag was here

target="_blank"><img class="statcounter"



But it does make sense,how can I right <a/> and also I do not understand what it means with the image tag.

Thanks,


BamBam



I think this thread will be long...:-)

bear
03-13-2010, 09:27 AM
alt="blogger counters" ></a></div></noscript>
Note the > right before the closing </a> tag? In XHTML, it needs a slash to end it: blogger counters" />
</a></div></noscript>I do not understand what it means with the image tag.An image, <img ...., it's what causes an image to show on the page. Are you sure you're ready for the advanced HTML you're trying to fix here?
I think this thread will be long
If you read the error carefully, it tells you exactly what the issue is, and you may learn how it works in the process.

bambinou
03-13-2010, 09:39 AM
Hi Bear,

Lol , No sorry, I knew what an image tag is, is just I could not understand the way it was worded.
Xhtml is something new to me, I only used html with front page lol.
That's why I am struggling a little.thanks for your help.


BamBam

Driver01
03-13-2010, 11:42 AM
bambinou,

Thats fine, just take a look around google and read a bit up on the difference between html and xhtml, basically xhtml is an eXtensible form of html and to be honest I would guess that you only need to use html?
But if you have this already created in xhtml and you want to carry on with what you are doing, which is cleaning up the code then just take 5 minutes to understand, it will do you good and you never know you might enjoy it. The reason you get the error from the img tag is xhtml use self closing tags, which basically means html tag that doesn't have a closing end tag like <img> must self-close itself in xhtml i.e.

this anchor tag doesn't need it because it has a closing tag in bold:

<a href="link">Link</a>

whereas the <img> tag doesn't so xhtml requires you to whats called self-close, like this:

<img src="link" />

and this would apply to all tags like this, so if you see this error again you will know why.

bambinou
03-13-2010, 11:49 AM
Hi Driver,

thank you so much for the explanations, there is one thing I would really like to know, for example an error like this:
<a href="link">Link</a>

whereas the <img> tag doesn't so xhtml requires you to whats called self-close, like this:

<img src="link" />

Could this cause google not to index the site properly?
as I have about 250 errors now and 40 warnings, I am very surprised because the guys that designed my site were apparently pretty good...I am confused...

Thanks,


BamBam

Driver01
03-13-2010, 12:03 PM
Could this cause google not to index the site properly?

Not sure about that, not really but it certainly helps to have valid, clean mark-up. Search engine indexing is quite complex and is an art in itself but they are certain rules that you can follow to promote it. Designing a website can be done quite easily, but making it a well balanced, valid, accessible, symantic search engine friendly project is something else. Html is more indepth then alot of people understand and making it correctly takes understanding of how it works. The fact that they missed the doctype tells me that they are probably not as thorough as you thought. Every designer worth their salt knows that there is more to having a nice looking site which works in a couple of the more forgiving browsers...

bambinou
03-13-2010, 01:21 PM
thanks for that, I will email them and tell them they are c...p, only kidding, but still , it seems to be a big mistake what they did.


Thanks for your help,


BamBam