Various types of HTML tags
Various types of HTML tags
Structural tags in HTML define the essential skeleton and hierarchy of a web page. They act as containers that organize the document into logical parts
<!DOCTYPE html>: Although technically a declaration rather than a tag, it is the first line of any document. It tells the browser to use HTML5 standards for rendering the page.<html>: Known as the root element, it wraps the entire document. It signals the start and end of all HTML code.<head>: This section serves as a container for metadata (data about the data). Content here is not visible to users but is vital for browsers and search engines.<body>: This is the main container for all visible content. Every heading, paragraph, image, and link that a user sees must be placed inside these tags.
<b>(Bold): Makes text bold without adding extra importance.
Example:<b>This text is bold</b><i>(Italic): Slants the text for technical terms, phrases from another language, or thoughts.
Example:<i>This is italicized</i><u>(Underline): Adds an underline. (Note: Avoid using this for regular text as it can be confused with a link).
Example:<u>Underlined text</u>- The Paragraph Tag
<p>The<p>tag is a container element used to define a block of text. - The
<br>tag is an empty element (it doesn’t have a closing tag) used to start a new line without starting a new paragraph.
<link> tag used in the <head> and the anchor <a> tag used in the <body>.- Anchor Tag (
<a>): Creates a clickable hyperlink that allows users to navigate from one page to another. - Link Tag (
<link>): An empty element placed in the <head> that defines a relationship with an external resource.
- Image Tag (
<img>): Used to display static images. - Audio Tag (
<audio>): Embeds sound files like.mp3or.ogg. - Video Tag (
<video>): Embeds video content in formats like.mp4or.webm
Lists and Tables tags
Lists and tables are the primary ways to organize and present data in HTML. Lists are used for sequential or grouped items, while tables are used for structured, two-dimensional data.
- Unordered List (
<ul>): Used for items where the order doesn’t matter. It displays with bullet points.- Example: A shopping list.
- Ordered List (
<ol>): Used for items that follow a specific sequence. It displays with numbers or letters.- Example: A recipe or step-by-step instructions.
- List Item (
<li>): This tag is used inside both<ul>and<ol>to define each individual item.
<table>: The main wrapper for the entire table.<tr>(Table Row): Defines a horizontal row of cells.<th>(Table Header): Defines a header cell at the top of a column. The text is usually bold and centered by default.<td>(Table Data): Defines a standard cell containing the actual data.
Semantic (Layout) Tags
<header>: Marks the top section of a page or a specific section, typically containing the site logo, titles, or introductory content.<nav>: Specifically reserved for the set of navigation links, such as menus, tables of content, or indexes.<main>: Defines the unique, primary content of the document.