Forum Moderators: mack

Message Too Old, No Replies

What is the value of adding Doctype and Meta

         

kittimakai

11:41 am on Feb 25, 2004 (gmt 0)

10+ Year Member



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

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

As the title says; I see these a lot but do not know their significance. Anybody want to show me the light?

Kitti

grahamstewart

12:31 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DOCTYPE

The doctype tells the browser which version of HTML you used to created your page. If you do not supply it then the browser must guess (and could get it wrong).

Using a FULL doctype (like the doctypes listed by the w3c [w3.org]) will put the browser in 'Standards Compliant' mode - making it follow the w3c standards more carefully.

Content-Type

Content-Type tells the browser that the page contains html written in the UTF-8 character set (or whatever other character set you enter there).

Selecting a character set means that the browser can correctly render wierd characters without you having to use html entities (e.g. you can just type an acute instead of having to use

&aacute;
.

Both of the tags are required before you can properly validate your html with the w3c validator [validator.w3.org].

kittimakai

1:11 pm on Feb 25, 2004 (gmt 0)

10+ Year Member



Thank you Graham :)

A typically excellent response

tell me this, if I were to add the doctype and it didn't quite adhere to the standards would I be somehow penalised?

I know I should to get my pages validated, but not just yet - should I wait until I have done this or add the doctype tag now?

Many Thanks

Kitti

grahamstewart

3:30 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope there is no penalty as such.

But I suggest that you develop your pages with a doctype in place from the very start. For two reasons:

  • a full doctype may alter the box model used by the browser so you'll need to take that into account when creating the pages.

  • you should really validate your pages as you create them. This will help pick up errors that could stop your pages being displayed correctly (or worse could stop spiders from indexing them!).

    Validation actually makes page development much easier - honest - think of it as part of the process, as if you are 'compiling' your html.

  •