Various types of HTML tags

 

The Core Structural 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.

 

Text Formatting Tags
 
Text formatting tags are used to change the appearance of text and to give it specific meaning (semantics). 
 
  • <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 and Media Tags
 
 
1. Link Tags
While often confused, there is a distinct difference between the <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.

 

2. Media Tags
Introduced in HTML5, these tags allow for seamless multimedia integration without needing external plugins.
  • Image Tag (<img>): Used to display static images.
  • Audio Tag (<audio>): Embeds sound files like .mp3 or .ogg.
  • Video Tag (<video>): Embeds video content in formats like .mp4 or .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.

1. HTML Lists
There are three main types of lists used to group related items.
  • 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.

 

2. HTML Tables
Tables allow you to arrange data into rows and columns. They require a specific hierarchy of tags to function correctly:
  • <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.