HTML is the standard markup language for creating Web pages.
- HTML stands for Hyper Text Markup Language
- HTML is the standard markup language for creating Web pages
- 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 label pieces of content such as "this is a heading", "this is a paragraph", "this is a link", etc.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
All HTML documents must start with a document type declaration: <!DOCTYPE html>
.
The HTML document itself begins with <html>
and ends with </html>
.
The visible part of the HTML document is between <body>
and </body>
.
The HTML element is everything from the start tag to the end tag:
<tagname>
Content goes here...</tagname>
Examples of some HTML elements:
<h1>
My First Heading</h1>
<p>
My first paragraph.</p>
- All HTML elements can have attributes
- Attributes provide additional information about elements
- Attributes are always specified in the start tag
- Attributes usually come in name/value pairs like: name="value"
HTML headings are defined with the <h1>
to <h6>
tags.
<h1>
defines the most important heading. <h6>
defines the least important heading.
<h1> Heading 1 </h1>
<h2> Heading 2 </h2>
<h3> Heading 3 </h3>
<h4> Heading 4 </h4>
<h5> Heading 5 </h5>
<h6> Heading 6 </h6>
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
The HTML <p>
element defines a paragraph.
A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.
The HTML style
attribute is used to add styles to an element, such as color, font, size, and more.
The style
attribute has the following syntax:
<tagname
style="property:value;">
HTML contains several elements for defining text with a special meaning.
Formatting elements were designed to display special types of text:
<b>
- Bold text
<strong>
- Important text
<i>
- Italic text
<em>
- Emphasized text
<mark>
- Marked text
<small>
- Smaller text
<del>
- Deleted text
<ins>
- Inserted text
<sub>
- Subscript text
<sup>
- Superscript text
HTML comments are not displayed in the browser, but they can help document your HTML source code.
You can add comments to your HTML source by using the following syntax:
<!-- Write your comments here -->
HTML links are hyperlinks.
You can click on a link and jump to another document.
When you move the mouse over a link, the mouse arrow will turn into a little hand.
The HTML <a>
tag defines a hyperlink. It has the following syntax.
<a href="url">link text</a>
The most important attribute of the <a>
element is the href
attribute, which indicates the link's destination.
The link text is the part that will be visible to the reader.
Clicking on the link text, will send the reader to the specified URL address.
Images can improve the design and the appearance of a web page.
The HTML tag is used to embed an image in a web page.
Images are not technically inserted into a web page; images are linked to web pages. The <img>
tag creates a holding space for the referenced image.
The <img>
tag is empty, it contains attributes only, and does not have a closing tag.
<img src="url" alt="alternatetext">
HTML lists allow web developers to group a set of related items in lists.
1.Unordered lists
Example<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
- Coffee
- Tea
- Milk
2.Ordered lists
Example<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
- Coffee
- Tea
- Milk