HTML Notes
HTML Notes
Table of Contents
Introduction
Basic Structure
Elements
Attributes
Headings
Paragraphs
Links
Images
Lists
Tables
Introduction
HTML (HyperText Markup Language) is the standard markup language for creating web
pages. It describes the structure of a web page and consists of a series of elements that tell the
browser how to display content.
Basic Structure
Every HTML document has a basic structure that includes the following elements:
1. <!DOCTYPE html>: This declaration defines the document type and version of HTML.
2. <html>: The root element that contains all the other elements.
3. <head>: Contains meta-information about the document, such as the title.
4. <title>: Sets the title of the document, which appears in the browser's title bar or
tab.
5. <body>: Contains the content of the document, such as text, images, and links.
Elements
HTML elements are the building blocks of HTML pages. They are defined by a start tag,
some content, and an end tag. For example, a paragraph element is defined with <p> (start
tag) and </p> (end tag) with the content in between.
Attributes
HTML attributes provide additional information about HTML elements. They are always
included in the opening tag and usually come in name/value pairs like name="value". For
example, the href attribute in a link specifies the URL the link goes to.
Headings
HTML headings are defined with the <h1> to <h6> tags. <h1> defines the most important
heading, while <h6> defines the least important heading. Headings are used to create a
structure for the document.
Paragraphs
HTML paragraphs are defined with the <p> tag. They are used to define blocks of text. Each
paragraph starts on a new line and is usually separated from the other content by some space.
Links
HTML links are defined with the <a> tag. The href attribute specifies the URL of the page
the link goes to. Links can be used to navigate from one page to another or to other resources.
Images
HTML images are defined with the <img> tag. The src attribute specifies the path to the
image, and the alt attribute provides alternative text if the image cannot be displayed.
Images can be part of the content or used decoratively.
Lists
HTML lists are used to group related items. There are two types of lists:
Tables
HTML tables are defined with the <table> tag. A table consists of rows (<tr>), and each
row is divided into cells (<td>). Table headers can be defined with the <th> tag, which
makes the text bold and centered by default. Tables are used to display data in a structured
format.