Understanding HTML Tags and Elements A Comprehensive Guide!!



1. HTML Tags:

Definition,

HTML tags are the fundemental components of HTML syntax. They're enclosed in angle brackets ('<>') and are used to define the structure of an HTML document. Tags typically come in pairs – an opening tag and a closing tag – with content nested between them. The opening tag indicates the beginning of an element, and the closing tag denotes the end.

Example,



In this example, '<p>' is the opening tag, and '</p>' is the closing tag, encupsulating the paragraph content.

Common HTML Tags:

  1. '<html>': Defines the root element of an HTML document.
  2. '<head>': Contains meta- information about the HTML document, such as title and links to stylesheets.
  3. '<body>': Encloses the content of the HTML document, including textbook, images, and othe elements.
  4. '<h1> to <h6>': Headings of different levels, with '<h1>' being the highest and '<h6>' the lowest.
  5. '<p>': Represents a paragraph.
  6. '<a>': Creates hyperlinks, linking to other web pages or resources.
  7. '<img>': Embeds images into the document.
  8. '<ul>': Defines an unordered list.
  9. '<ol>': Defines an ordered list.
  10. '<li>': Represents a list item.

2. HTML Elements:

Definition,

An HTML element is a complete set of tags and content, working together to define a specific part of a web page. Each HTML element consists of an opening tag, content, and a closing tag. Some elements are self- closing and dont require a closing tag.
Example,


In this example, ''<a>" is the opening tag, ''</a>" is the closing tag, and the text " Visit our website" is the content of the anchor element, creating a hyperlink. 

Common HTML Elements: 

  1. ''<a>" ( Anchor Element): 
  • Attributes: 'href' ( specifies the URL). 
  • Usage: Creates hyperlinks. 


  1.  '<img>' ( Image Element) 
  • Attributes: 'src' ( specifies the image source), 'alt' ( provides necessary text for accesbility).
  • Usage: Embeds images into the document. 



  1. ''<p>" ( Paragraph Element) 
  • Usage: Represents a paragraph. 


  1.  '<h1> to '<h6>' ( Heading elements) 
  • Usage: Defines headings of different levels.


  1. '<ul>' ( Unordered List Element) 
  • Usage: Defines an unordered list. 


  1. 6.( Ordered List Element) 
  • Usage: Defines an ordered list.
 

 
  1. '<div>' ( Division Element) 
  • Usage: Defines a generic container to group other Elements. 


  1. '<span>' ( Inline Container Element) 
  • Usage: Defines a generic inline Container.



These example represent just a fraction of the multitude of HTML elements available for structuring and presenting content on the web.




Post a Comment

Previous Post Next Post