HTML is a markup language for describing web documents (web pages).
- HTML stands for Hyper Text Markup Language
- A markup language is a set of markup tags
- HTML documents are described by HTML tags
- Each HTML tag describes different document content
Below is an example of a very simple and small web page.
<!DOCTYPE html> <html> <head> <title>My Page title</title> </head> <body> <h1>Welcome</h1> <p>Hello and welcome to my web page.</p> </body> </html>
- The DOCTYPE declaration defines the document type to be HTML
- The text between <html> and </html> describes an HTML document
- The text between <head> and </head> provides information about the document
- The text between <title> and </title> provides a title for the document
- The text between <body> and </body> describes the visible page content
- The text between <h1> and </h1> describes a heading
- The text between <p> and </p> describes a paragraph
HTML tags are keywords (tag names) surrounded by angle brackets:
HTML tags normally come in pairs like <p> and </p>
The first tag in a pair is the start tag, the second tag is the end tag
The end tag is written like the start tag, but with a slash before the tag name
You can create a web page file using a simple text editor. Create a file named index.html ot index.htm and copy in the above code for the simple web page at the top of this page. Save the file on your computer and open it with a browser.
Empty HTML Elements
HTML elements with no content are called empty elements.
<br> is an empty element without a closing tag (the <br> tag defines a line break).
Empty elements can be “closed” in the opening tag like this: <br />.
HTML5 does not require empty elements to be closed. But if you want stricter validation, or you need to make your document readable by XML parsers, you should close all HTML elements.
The next blog post s called HTML Introduction Part 2.