Table of contents
HTML, or HyperText Markup Language, is the standard markup language used for creating web pages. HTML allows developers to structure content on a page by using a variety of tags and attributes. HTML tags are used to describe the content of a web page, while attributes provide additional information about the tags.
Some of the most important HTML tags include
<html>
: This tag is used to indicate the beginning of an HTML document. It is placed at the very beginning of an HTML file and signals to the browser that the document is an HTML document. Here is an example of how it would be used:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<!-- content goes here -->
</body>
</html>
<head>
: This tag is used to contain the metadata of the HTML document, including the page title, links to CSS stylesheets, and other information that is not displayed on the page. Here is an example of how it would be used:
<head>
<title>My Website</title>
<link rel="stylesheet" href="style.css">
<meta name="description" content="This is my website.">
</head>
<title>
: This tag is used to define the title of the web page, which appears in the browser's title bar. Here is an example of how it would be used:
<head>
<title>My Website</title>
</head>
<body>
: This tag is used to contain the visible content of the web page, including text, images, and other media. Here is an example of how it would be used:
<body>
<h1>Welcome to my website!</h1>
<p>This is some text on my website.</p>
<img src="image.jpg" alt="A picture">
</body>
<h1>
,<h2>
,<h3>
,<h4>
,<h5>
,<h6>
: These tags are used to define headings of various sizes, with<h1>
being the largest and<h6>
being the smallest. Here is an example of how they would be used:
<h1>This is a heading</h1>
<h2>This is a subheading</h2>
<h3>This is a sub-subheading</h3>
<p>
: This tag is used to define paragraphs of text. Here is an example of how it would be used:
<p>This is a paragraph of text on my website.</p>
<img>
: This tag is used to display images on a web page. It requires asrc
attribute to specify the image file's URL. Here is an example of how it would be used:
<img src="image.jpg" alt="A picture">
<a>
: This tag is used to create hyperlinks to other web pages or resources. It requires anhref
attribute to specify the URL of the linked page. Here is an example of how it would be used:
<a href="https://example.com">Click here to go to Example.com</a>
<ul>
,<ol>
,<li>
: These tags are used to create lists.<ul>
and<ol>
are used to define unordered and ordered lists, respectively, while<li>
is used to define individual list items. Here is an example of how they would be used:
<ul>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ul>
<ol>
<li>List item 1</li>
<li>List item
Conclusion
These are just a few of the many HTML tags available for creating web pages. By learning how to use these tags effectively, developers can create well-structured and visually appealing web pages that are easy to navigate and understand.