View Full Version : question re: top of html pages
keltoid
07-07-2003, 19:55/07:55PM
Is it important to have something like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> at the top of your html pages? I almost never put this on my pages, but see it alot.
What exactly is this and what does it do/mean?
Same question for something like this:
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
or
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Always wondered what the heck language this is!!
And mostly the Big Question: Is it important and what are the differences between one and the other?
Thanks - your forums are so helpful and the people so nice.
:hi:
Bernard
07-07-2003, 20:16/08:16PM
Originally posted by keltoid
Is it important to have something like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> at the top of your html pages? I almost never put this on my pages, but see it alot.
What exactly is this and what does it do/mean?
This specifies which version of the HTML standard your page adheres to. This is supposed to help browsers render your page correctly. Not all browsers require it (in fact, I'm not sure any do).
Originally posted by keltoid
Same question for something like this:
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
or
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
This specifies which character set the page was designed for so that a browser knows to use Chinese or English or whatever.
scottiecl
07-07-2003, 20:17/08:17PM
What you are seeing is a Document Type Declaration (DTD) (http://www.w3.org/QA/2002/04/valid-dtd-list.html) and it is neccessary to have on the page in order for your page to validate.
The second thing is charcter encoding (http://www.w3.org/International/O-charset.html) and it helps a browser to determe the proper character set to display.
dvduval
07-07-2003, 22:41/10:41PM
This is important for html validation. Some people have strong views on this topic. You can get away without having it, but it's probably better to use it. I would recommend you do some testing and reading here:
http://validator.w3.org/
traveller
08-07-2003, 01:51/01:51AM
I would really like to know how important it is for Google. I have heard that google really likes to see it and is something that goes in your favor if you have it.
I went the other day to have my pages validated and it said it could not for various reasons.
To validate the page does it only mean adding these lines
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
at the top of each page or is it more?
Your help is noted
g1smd
08-07-2003, 19:33/07:33PM
Your document should begin with a !DOCTYPE and a <title> element:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Your Title Here </title>
For some modern browsers, they will render the page in Standards Mode if a DOCTYPE is seen at the top of the page.
For your page to actually be valid you MUST declare the character encoding used for the page, with something like:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
There are also other schemes such as UTF-8 and many others.
It is also a good idea to declare what language the page is in, using:
<meta http-equiv="Content-Language" content="EN-GB">
The language and country codes come from ISO 4217 and ISO 3166.
You do need the meta description tag for search engines to index, and it is useful but not vital to have a meta keywords tag:
<meta name="Description" content=" Your Description Here. ">
<meta name="Keywords" content=" your, keyword, list, here ">
The last parts of your header should have your links to external style sheets using one of two formats.
Most people use this one:
<link type="text/css" rel="stylesheet" src="/path/file.css">
However, if you want to hide the CSS from Netscape 4, as NS4 chokes on most CSS it sees, then use this one instead:
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
@import url(path/file.css);
</style>
The final part of the header should have any links to external javascript files:
<script type="text/javascript" language="javascript" src="/path/file.js"></script>
</head>
<body>
traveller
08-07-2003, 21:38/09:38PM
Thank you very much, but second question.
Is this something that is neccesaary and usefull?
Does it help to have it for the search engines?
Is there anything negaitve if you do have it?
chrishirst
09-07-2003, 08:29/08:29AM
Is this something that is neccesaary and usefull?
Yes if you want your pages to look exactly as you designed them in all browsers
Does it help to have it for the search engines?
Nope it will make no difference at all
Is there anything negaitve if you do have it?
Nope it is positive see point 1
Chris.
keltoid
07-08-2003, 13:14/01:14PM
Thanks everyone very much for all the information - now I understand! And that, it itself, is quite a feat.
:D
K
BatikShirtShop (http://www.bss.com)
Waxing Moon Batik (http://www.waxing-moon.com)
g1smd
08-08-2003, 15:13/03:13PM
Glad you made it back to this thread.
Thought that I had frightened you off.
keltoid
13-08-2003, 16:35/04:35PM
Ha ha - never - g1smd! This is a great forum, very helpful!
vBulletin® v3.8.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.