Xah Lee, 2009-09-29
This page gives a very basic, practical introduction to HTML.
HTML is a very simple markup language. Here's a example. Put the following text in a file, and view the file in a browser.
<html> <head> <title>Sample HTML</title> </head> <body> <h1>Sample HTML</h1> <p>Earth is round!</p> </body> </html>
Basically, text are wrapped around with tags. For example, in the above, the “<html>” and “</html>” wraps around the whole file indicating that the whole file is a html file. The “<head>” and “</head>” contains some meta info about the file. The “<title>...</title>” gives the title of the file. What's inbetween “<body>” and “</body>” are the content of the file. The “<h1>...</h1>” is the header of the content. The “<p>” is a paragraph.
Each of the “<...>” is called a tag.
HTML is extremely simple. There are hundreds of HTML tutorials. You can try this tutorial: http://www.w3schools.com/html/html_intro.asp. For some history and technical detail, see: HTML.
We assume you have gone thru the above tutorial or know the basics of HTML. If you plan to do javascripting and advanced css, you must know HTML well.
There are many versions of html and xhtml, and it is really a mess.
If you are creating new pages, not maintaining old websites, i recommend HTML 4. Put the following line at the beginning of your file.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
This line, that declares the version, is called Document Type Definition (DTD).
The above DTD is for HTML 4. It is supported in all major browsers released after 1996.
HTML 4 is most widely used. Using html 4, “strict” version, has the advantage of makes your html code clean, according to today's html practices.
If you must go for more compatibility, i recommend HTML 4 Transitional.
For more detail on the various versions, see: HTML.