List of some common HTML tags and their basic syntax:
<!DOCTYPE>
Declaration:
Syntax:
<!DOCTYPE html>
Description: Declares the document type and version of HTML being used. In modern HTML, you typically use
<!DOCTYPE html>
to indicate HTML5.
<html>
Element:Syntax:
<html> ... </html>
Description: The root element that contains all other HTML elements.
<head>
Element:Syntax:
<head> ... </head>
Description: Contains metadata about the document, such as the page title, character encoding, and links to external resources.
<title>
Element:Syntax:
<title>Page Title</title>
Description: Sets the title of the web page, which appears in the browser's title bar or tab.
<body>
Element:Syntax:
<body> ... </body>
Description: Contains the visible content of the web page, including text, images, links, and more.
Headings (
<h1>
to<h6>
):Syntax:
<h1>Heading 1</h1>
to<h6>Heading 6</h6>
Description: Defines headings of different levels, with
<h1>
being the highest level of importance and<h6>
the lowest.
<p>
Element:Syntax:
<p>This is a paragraph of text.</p>
Description: Defines a paragraph of text.
<hr>
Element (Horizontal Rule):Syntax:
<hr>
or<hr/>
Description: Creates a horizontal line on the page to separate content.
<br>
Element (Line Break):Syntax:
<br>
or<br/>
Description: Forces text onto the next line without creating a new paragraph.
<b>
Element (Bold Text):
Syntax:
<b>This text is bold.</b>
Description: Defines text as bold.
<i>
Element (Italic Text):
Syntax:
<i>This text is italic.</i>
Description: Defines text as italic.
<sub>
Element (Subscript):
Syntax:
<sub>Subscript</sub>
Description: Defines text as a subscript.
<sup>
Element (Superscript):
Syntax:
<sup>Superscript</sup>
Description: Defines text as a superscript.