You are on page 1of 14

HTML

What is HTML?

• 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.
A Simple HTML Document

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>
• The <!DOCTYPE html> declaration defines that this document is an
HTML5 document
• The <html> element is the root element of an HTML page
• The <head> element contains meta information about the HTML page
• The <title> element specifies a title for the HTML page (which is
shown in the browser's title bar or in the page's tab)
• The <body> element defines the document's body, and is a container
for all the visible contents, such as headings, paragraphs, images,
hyperlinks, tables, lists, etc.
• The <h1> element defines a large heading
• The <p> element defines a paragraph
What is an HTML Element?

An HTML element is defined by a start tag, some


content, and an end tag:
<tagname> Content goes here... </tagname>
The HTML element is everything from the start tag to
the end tag:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
HTML Page Structure
HTML Links
HTML links are defined with the <a> tag:

<a href="https://www.w3schools.com">This is a link</a>

HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are provided as attributes:

<img src="w3schools.jpg" alt=“image" width="104" height="142">


HTML Line Breaks

The HTML <br> element defines a line break.


Use <br> if you want a line break (a new line) without starting a new paragraph:

<p>This is<br>a paragraph<br>with line breaks.</p>


HTML Styles
The HTML style attribute is used to add styles to an element, such as color, font, size, and more.

<tagname style="property:value;">

Background Color

<body style="background-color:powderblue;">

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>

Text Color

<h1 style="color:blue;">This is a heading</h1>


<p style="color:red;">This is a paragraph.</p>
Fonts
<h1 style="font-family:verdana;">This is a
heading</h1>
<p style="font-family:courier;">This is a
paragraph.</p>

Text Size
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>

Text Alignment
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>
HTML Text Formatting
HTML Formatting Elements
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
HTML comments are not displayed in the browser, but they can help
document your HTML source code.
HTML Comment Tag
You can add comments to your HTML source by using the following
syntax:

<!-- Write your comments here -->

Example
<!-- This is a comment -->

<p>This is a paragraph.</p>

<!-- Remember to add more information here -->


HTML Forms
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<br>
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<br>
<input type="submit" value="Submit">
</form>
HTML Dropdown Menu
<label for="dropdown">Choose an option:</label>
<select id="dropdown" name="dropdown">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select>

You might also like