What do I put at the top of the html page I just made? I'm sort of a beginner and I dont really know how to do the doctype? Also, how do i put my copyright in?

4 answers

This was chosen as the best answer

You should put a doctype which matches the HTML you have created. If you have written xhtml-compliant code (all html tag names and attributes are in lower case, all "empty" elements such as img have a closing slash (e.g.)

<img src="foo" alt="bar" />

then choose an xhtml transitional doctype. In all other cases I would now recommend the HTML doctype:

<!DOCTYPE html>

It is simple and backwards-compatible and HTML 5 is probably the most liberal standard. Once you have a doctype you can validate against it at validator.w3.org

Note that you should not put anything above the doctype, as it will cause some versions of Internet Explorer to render in "quirks mode", causing unexpected results.

Answered almost 10 years ago by Richard Grevers
danwellman 5600

I would use either HTML 4.01 strict: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Or as Rich says, the HTML 5 doctype if you plan to use any of the new HTML elements (aside, video, audio, etc).

I would avoid a transitional DOCTYPE - these were added to the HTML/XHTML spec in order to help people transition from earlier versions to HTML 4.01/XHTML 1. No one should be in a position where they are still wanting to use HTML 3 elements ;)

Copyright statements are usually added to the footer in a <p> element (there are no special copyright elements). Use the &copy; entity to get the nice © symbol. You can use Javascript to set the copyright to the current year instead of hardcoding it to avoid having to remember to update it every year (or risk it looking old!), something like:

<script type="text/javascript">
  var today = New Date(),
    year = today.getFullYear(),
    copyP = document.createElement("p"),
    copyText = document.createTextNode("Copyright &copy; " + year + " Name of Copyright Holder"),
    footer = document.getElementById("footer");


Answered almost 10 years ago by danwellman

you can also add your copyright in the author meta element:

<meta name="author" content=" copyright 2009 Tony Crockford  http://www.boldfish.co.uk for client name " />
Answered almost 10 years ago by Tony Crockford

see also:


which covers the topic in depth

Answered almost 10 years ago by Tony Crockford