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

3
points
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 over 7 years ago by Richard Grevers
danwellman 5600
2
points

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");

  copyP.appendChild(copyText);
  footer.appendChild(copyP);

</script>
Answered over 7 years ago by danwellman
0
points

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 over 7 years ago by Tony Crockford
0
points

see also:

http://dev.opera.com/articles/view/14-choosing-the-right-doctype-for-your/

which covers the topic in depth

Answered over 7 years ago by Tony Crockford