HTML Basic Tags


HTML Heading

When we create any document, Heading is the most important thing. There are six heading tags in HTML. When we write a heading, the browser adds one line before and after the heading. HTML Heading Tags are

<h1>
<h2>
<h3>
<h4>
<h5>
<h6>

H1 is the Biggest Heading and H6 is smallest Heading


A Sample HTML Headings

This is the example of six different types of heading in HTML

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h6>This is Heading h6</h6>
<h5>This is Heading h5</h5>
<h4>This is Heading h4</h4>
<h3>This is Heading h3</h3>
<h2>This is Heading h2</h2>
<h1>This is Heading h1</h1>
</body>
</html>

After Excuting Above HTML Result looks like

This is Heading h6
This is Heading h5

This is Heading h4

This is Heading h3

This is Heading h2

This is Heading h1



Paragraph Tag

Paragraph is the basic text in HTML Document, It gives structure to your content For writing any paragraph in HTML document, we use <P> Tag

Paragraph Example

This is the example of Paragraph Tag Which will print "This is Paragraph" in the browser.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<p>This is Paragraph</p>
</body>
</html>

HTML Links

Anchor Tag or Link Tag is used for opening a link or document from an HTML Document. In HTML Links tags are defined as <a>

Anchor Tag Example

This is the example of Anchor Tag which will print "This is my website Link" in the browser to open another website from an HTML Document

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<a> href="URL Link">This is my website Link</a>
</body>
</html>

HTML Images

When we have Use images in Document, we use Images tags <img>


Image Tag Example

This is the example of Image Tag which will show image in the browser.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<img src="Image path" alt="Alternative text of Image" Height="100px" Width="100px">
</body>
</html>

HTML Line Break

When we want space between two line or start from new line we use <br/> tag.These are empty tag we don't need any text between the tags.We dont need opening and closing Tags for Line break. we use Line break tag <br/>. In HTML <br/> this is valid Tag but <br> This is not valid tag.


Image Tag Example

This is the example of Line Break Tag.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<p>This is my <br/> Paragraph</p>
</body>
</html>

Centering Content

When we want to center our content, we have to use Center tag inside the HTML Document. This Tag will center our text of the Paragraph


Center Tag Example

This is the example of Center Tag.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<center>
<p>This text is in the center.<p>
<center>
</body>
</html>

Preserve Formatting

When we want to show our text same as it as written in HTML, Then we have use pre tag in HTML. Any Content written inside pre Tag It is show like that only


Pre Tag Example

This is the example of Pre Tag.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<pre>
function text(){
show();
}
<pre>
</body>
</html>