Forum Moderators: open
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Now, is there someone that can break these down and explain what exactly is going on?
Also, can any web site use the above tags or are there site-specific changes that need to be made within them?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
The DOCTYPE is exactly that, the type of document that this page is. IE: HTML/PUBLIC the quoted attribute that follows is the DTD (Document Type Definition) that defines the rules to which the page should adhere to.
There are lots of different DTD's and Doctypes, I prefer XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
Have a look below this post, there have been some great discussions re: XHTML/CSS recently.
The next bit I'm fairly sure is unnessassary as you have already defined the text/html bit and the charicter encoding could (I think) go in the <html> tag. Someone else should be able to shed some light on that though.
In XHTML you specify the charicter encoding in the xml declaration like this:
<?xml version="1.0" encoding="iso-8859-1"?>
If you want to read up on all this try the w3c xhtml section here [w3.org]
Nick
old table based font tag sites would normally declare html 3...newer strictly css layout sites would usually be html 4 strict or xhtml...those in between might well be html 4 transitional like WebmasterWorld (and most of my recent sites)
[w3.org ]
the doctype should really be decided before you mark up the content...then you know what tags you can and can't use
the charset declaration tells the browser how the text on the page is to be rendered
in the case of WebmasterWorld it is utf-8...that is Unicode which allows for a full range of characters in the vast majority of languages...essential for an international interactive site like this
[alanwood.net ]
purely English (or any other language only using Latin characters) would normally be encoded with ISO-8859-1...for Japanese one might use shift_jis...Russian sites normally seem to use Windows 1251...again you should really decide this before you start work on the site
type of document that this page is. IE: HTML/PUBLIC
Actually, I don't think that's correct strictly speaking.
The document type is HTML
PUBLIC tells the user agent to use the commonly available public DTD for this doctype, in this case
HTML 4.01 Transitional
It could alternatively tell the user agent that it is an HTML document, but to use a SYSTEM DTD which would require a valid URL to a DTD document that the user agent could find and use (if in fact any current user agents actually function that way).
Tom