HTML tags
HTML tags
display the content. With the help of tags, a web browser can distinguish
between an HTML content and a simple content. HTML tags contain three main
parts: opening tag, content and closing tag. But some HTML tags are unclosed
tags.
All HTML Tags are predefined, i.e., you cannot create new tags. Look at
the example below, this is an example of a paired tag. Observe that there
are two tags of same name, but the latter one has a slash / before it, it is
a closing tag. Now, what is a closing tag? Let's start with different types of
tags!
Syntax:
<p> Content </p>
There are two types of tags in HTML that are used by the Website
Designers:
Look at the list of some paired tags in HTML below. Notice that each tag
has a closing tag with a slash(/) before the name of the tag.
<html> </html>
<table> </table>
<form> </form>
<span> </span>
<ul> </ul>
<p> </p>
<head> </head>
Open Tag Close Tag
<div> </div>
Look below the list of some Unpaired Tags in HTML. Notice the use of
slash(/) in the tags, to close them.
Open Tag
<br>
<hr>
<meta>
<input>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Heading Tag </title>
</head>
<body>
<h1> This is Heading 1 </h1>
<h2> This is Heading 2 </h2>
<h3> This is Heading 3 </h3>
<h4> This is Heading 4 </h4>
<h5> This is Heading 5 </h5>
<h6> This is Heading 6 </h6>
</body>
</html>
Output
This is Heading 1
This is Heading 2
This is Heading 3
This is Heading 4
This is Heading 5
This is Heading 6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Paragraph Tag </title>
</head>
<body>
<p> This is First Paragraph </p>
<p> This is Second Paragraph </p>
<p> This is Third Paragraph </p>
</body>
</html>
Output
This is First Paragraph
This tag is called anchor tag and anything between the opening <a> tag
and the closing </a> tag becomes part of the link, and a user can click that
part to reach to the linked document.
Following is the simple syntax to use <a> tag.
<!DOCTYPE html>
<HTML lang="en">
<head>
<meta charset="UTF-8">
<title> HTML Anchor Tag </title>
</head>
<body>
<a target="_blank" href="https://www.coderepublics.com"> This is a link
</a>
</body>
</html>
Output
This is a link
Note : Use 'target = _blank' as an attribute in <a> tag to open the link in
a new tab.
Basic HTML
Tag Description
Head Tag
The head tag <head> contains all the elements describing the document.
Title Tag
The title tag <title> specifies the HTML page title, which is shown in the browser’s
title bar.
Body Tag
The body tag <body> is where you insert your web page’s content.
Paragraph Tag
Heading Tag
The HTML heading tag is used to define the heading of the HTML document. The
<h1> tag defines the most important tag, and <h6> defines the least.
Let’s practice using these tags and create a web page with them:
Formatting Tags
Emphasis tag
The HTML <em> tag is used to emphasize the particular text in a paragraph.
Bold Tag
Italic Tag
Underline Tag
Tags Descriptions
Used within the <head> section to define the title of the HTML
<title> document. It appears in the browser tab or window and provides a
brief description of the webpage’s content.
Basic HTML Tags for Document Structure
Tags Descriptions
<p style=”color:
Text color in HTML specifies the
pink;”>
Text Color color of the text content, similar to
Pink color is used
font color.
</p>