HTML Introduction
What is HTML?
HTML is the standard markup language for creating Web pages.
- HTML stands for Hyper Text Markup Language
- HTML describes the structure of a Web page
- HTML consists of a series of elements
- HTML elements tell the browser how to display the content
- HTML elements are represented by tags
- HTML tags label pieces of content such as "heading", "paragraph", "table", and so on
- Browsers do not display the HTML tags, but use them to render the content of the page
Example Explained
- The <!DOCTYPE html> declaration defines this document to be HTML5
- The <html> element is the root element of an HTML page
- The <head> element contains meta information about the document
- The <title> element specifies a title for the document
- The <body> element contains the visible page content
- The <h1> element defines a large heading
- The <p> element defines a paragraph
HTML Tags
HTML tags are element names surrounded by angle brackets:
<taganame>content goes here...</taganame>
- HTML tags normally come in pairs likeand
- 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 forward slash inserted before the tag name
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration represents the document type, and helps browsers to
display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The <!DOCTYPE> declaration is not case sensitive.
The declaration for HTML5 is: <!DOCTYPE HTML>
HTML headings are defined with the <h1> to <h6> tag.
<h1> defines the most important heading. <h6> defines the most important heading.
HTML Paragraphs
HTML paragraphs are defined with the <p>tag:
HTML Links
HTML links are defined with the <a> tag
The link's destination is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.
You will learn more about attributes in a later chapter.
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are provided as
attributes:
HTML Lists
HTML lists are defined with the (unordered/bullet list)
or
the (ordered/numbered list) tag, followed by <li>tags (list items):