Forum Moderators: phranque

Message Too Old, No Replies

Correct doc type.

         

ie111

3:34 pm on Mar 19, 2010 (gmt 0)

10+ Year Member




I am very much learning and have a very small amount of knowledge in code so please bear with me.

I recently purchased a 10 year old site that was built in Microsoft FrontPage 12.0.

I have cleaned up the existing code and after rereading here and there added the below doc type (there was no doc type when I got the site)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

My questions are is this correct doc type given the above?

Also in the head on some of the pages it has this meta tag

NO1,

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

And on other pages it has

NO2

<meta http-equiv="Content-Language" content="en-gb">

Which meta tag if any is correct and is the doc type ok?

Many thanks for any help received.

htmlbasictutor

5:31 pm on Mar 19, 2010 (gmt 0)

10+ Year Member



DOCTYPE declartion should be:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">


The other line you saw is the character encoding line. It should be just after the opening body tag.

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">


"Windows-1252 is a character encoding of the Latin alphabet, used by default in the legacy components of Microsoft Windows in English and some other Western languages." Wikipedia

"ISO-8859-1 is the default character set in most browsers." w3schools

en-gb indicates that the document is written using British English.

"According to the W3C recommendation you should declare the primary language for each Web page with the lang attribute inside the <html> tag" w3schools

<html lang="en">

rocknbil

7:04 pm on Mar 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Choosing the best doctype for your site [webmasterworld.com] (does not include HTML 5)

Character encoding, entity references and UTF-8 [webmasterworld.com]

ie111

7:44 pm on Mar 19, 2010 (gmt 0)

10+ Year Member



Many thanks for the reply htmlbasictutor,

Just so im sure with the below tag I have only ever seen this in the head of page where all the other meta tags are but are you saying it should be in the body

[size=2]<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">[/size]


Would the below be correct for a site thats had the code built in Microsoft FrontPage 12.0 and had all the code cleaned up:-


[size=2]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> </title>
<meta name="description" content=" ">
<meta name="keywords" content=" ">
</head>[/size]


Or would this be a better :-


[size=2]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> </title>
<meta http-equiv="Content-Language" content="en" />
<meta name="description" content=" ">
<meta name="keywords" content=" ">
</head>[/size]


Many thanks...

ie111

10:08 pm on Mar 19, 2010 (gmt 0)

10+ Year Member



Thank you for your reply rocknbil, I have read the great posts still a little un sure which one of the above to use thought (this is all new to me and over my head trying to learn).

Many thanks for your time

ie111

10:16 pm on Mar 19, 2010 (gmt 0)

10+ Year Member



Or would this be the best method?

[size=2]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> </title>
<meta http-equiv="Content-Language" content="en" />
<meta name="description" content=" ">
<meta name="keywords" content=" ">
</head> [/size]

g1smd

1:56 am on Mar 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would move the <title> down one line to be after the "en" line.

I haven't used the meta keywords tag for years.

Remove the closing slash from the meta http-equiv line. Closing slash is not needed in HTML 4.01 document.

phranque

12:41 pm on Mar 20, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en">
<title> </title>
<meta name="description" content=" ">
<meta name="keywords" content=" ">
</head>


- you should define your document type first (as in line #1 should have the DTD)
- it's good to define the language parameter in the html tag
- all meta elements go inside the head element
- it's good to define the content type and character encoding first.
- you should have your content language definition next and before any "language" is actually used, such as in the title element.
- the http-equiv meta elements should also be defined as http headers for the document, but in case this document isn't served by the source server, such as in the case of a proxy server or cache situation or if the document is being rendered using file: rather than http: then this information in the header can be helpful.
- using a validation tool can be helpful with correcting syntax mistakes:
The W3C Markup Validation Service [validator.w3.org]

ie111

12:52 pm on Mar 20, 2010 (gmt 0)

10+ Year Member



Many thanks g1smd for your reply,

So this would be correct

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en">
<title> </title>
<meta name="description" content=" ">
<meta name="keywords" content=" ">
</head>

After looking more here and there do I need both of the below or are they doing the same job? So maybe remove the meta tag one?

<html lang="en">

And

<meta http-equiv="Content-Language" content="en">

@g1smd I am reducing the existing meta keywords tag (it’s been there for years from the former webmaster and is way too long at present) to about 4 to 5 words for yahoo and bing really (in terms of ranking I know they play no part what so ever in Google as it is totally ignored due to people spamming them over the years).

Many thanks for all the replies received I am very grateful thank you.

phranque

1:09 pm on Mar 20, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



After looking more here and there do I need both of the below or are they doing the same job? So maybe remove the meta tag one?

as i described above, they serve different purposes.

the http-equiv is essentially external to the document and is used when necessary to recreate http headers for the document.

the lang= is a html attribute and can be used on any tag to define the language for the scope of that tag, in this case for the scope of the html tag.
the language could be switched within the scope of another tag within the document.
for example:
<html lang="en">
...
<body>
the spanish word for "hello" is "<span lang="es">hola</span>".
</body>
</html>

ie111

1:53 pm on Mar 20, 2010 (gmt 0)

10+ Year Member



@phranque

Got It, many many thanks for your time and expertise.

Thank you.