Xah Lee, 2009-09-29, 2011-10-04
This page gives a very basic, practical introduction to HTML.
HTML is a very simple markup language. Here's a example. Save the following text in a file, name it 〔sample.html〕, then open the file in a browser.
<!DOCTYPE HTML> <html> <head> <title>Sample HTML</title> </head> <body> <h1>Sample HTML</h1> <p>Earth is round!</p> </body> </html>
Basically, text are enclosed by tags. For example, in the above,
the <html>…</html> wraps around the whole file indicating that the whole file is a HTML file.
The <head>…</head> contains some meta info about the file. The
<title>…</title> gives the title of the file.
What's between <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 many versions of HTML and XHTML, and it is really a mess. If you are creating new pages, not maintaining old websites, i recommend HTML5. Put the following line at the beginning of your file.
<!DOCTYPE HTML>
See: HTML5 Tags.
blog comments powered by Disqus