HTML Basics
HTML Basics
1
HTML Basics
<!DOCTYPE html>
<html>
<head>
<title>Title of Page</title>
</head>
<body>
<p> Life begins at the end <br> of your comfort zone </p>
</body>
</html>
3
Explanation of the Example
5
HTML Basics
6
HTML Basics
• The head tag comes next which contains all the header
information of the web page or documents like the title
of the page and other miscellaneous information. This
information is enclosed within the head tag which opens
with <head> and ends with </head>.
• We can mention the title of a web page using
the <title> tag. This is header information and hence is
mentioned within the header tags. The tag begins
with <title> and ends with </title>.
7
HTML Basics
8
HTML Elements
9
HTML Elements
• Empty Elements
– Some HTML elements have no content (like the <br>
element). These elements are called empty elements.
Empty elements do not have an end tag.
• Nested HTML Elements
– An element within an element is called nested
element.
10
Example of Nested Element
<!DOCTYPE html>
<html>
<head>
<title> My first Program </title>
</head>
<body>
</body>
</html>
11
The href attribute specifies the URL of the page the link goes to
HTML Attributes
• Attributes provide additional information about
elements. They are always specified in the start
tag.
• Examples
• <img> Element
– <img src=“img_girl.jpg” alt=“alternative text”
width="500" height="600“ >
– src, alt, width and height are attributes of <img>
12
HTML Attributes
• <a> element
– <a href="https://www.google.com"> click here</a>
– Href is an attribute of <a>
• <p> element
– <p align=“left”> This is left aligned </p>
– Align is an attribute of <p>
13
HTML Basics
• HTML Headings
– These tags help us to give headings to the content of a
webpage. These tags are mainly written inside the body
tag. HTML provides us with six heading tags
from <h1> to <h6>. <h1> defines the most important
heading. Every tag displays the heading in a different style
and font size.
• HTML Paragraph
– These tags help us to write paragraph statements on a
webpage. They start with the <p> tag and ends with </p>.
14
HTML Basics
• HTML Break
– These tags are used for inserting a single line type break.
It does not have any closing tag. In HTML the break tag
is written as <br>. Example:
<!DOCTYPE html>
<html>
<head>
<title> My first Program </title>
</head>
<body>
<p> Life begins at the end <br> of your comfort zone </p>
</body>
</html>
15
HTML Basics
16
HTML Basics
• Anchor Tag
• The <a> tag defines a hyperlink, which is used to link
from one page to another.
• <a href="https://www.google.com"> click here</a>
• <b> Tag
• This is used to bold the text.
• <p>This is normal text<b>and this is bold text</b></p>
17
• <i> Tag
– It is used to italicize the text in HTML
– <p><i>This is Italicized text</i>This is simple text</p>
• <u> Tag
– It is used to underline the text in HTML.
– <p>This is some <u>underlined</u> text.</p>
18
19