HTML - Comments ,Tags v/s Elements and Attributes

Photo by KOBU Agency on Unsplash

HTML - Comments ,Tags v/s Elements and Attributes

Introduction to HTML Comments

Hey, guys let's discuss HTML comments, which are to add notes and explanations to your HTML.

They are used to provide context and documentation for the code and can be useful for commenting out parts of your code that you want to temporarily disable without removing them entirely.

comments in HTML

you can add your comments to your HTML code by enclosing them within the

<!--hello web devs-->tag

HTML Tags

In HTML, Tags are used to define the structure and layout of a webpage.They are the building blocks that are used to create elements on a page.

for example: <p> tag is used to create a paragraph element

<h1> tag is used to create a heading element

output:

The Tag may appear in pairs, with an opening tag and a closing like : <tag>content</tag>

HTML Elements

Elements are the individual components of an HTML document, such as headings, paragraph and images. Each element is represented by corresponding HTML Tags.

for example: heading element is represented by the <h1>,<h2>,<h3> etc. tags and for paragraph element <p> tag

HTML Attributes

Attributes are used to provide additional about an element. They are added to the opening tag of an element and they always come in the form of name-value pairs.

for example : the src attribute is used to specify the source of an image

href attribute is used to specify the destination of a link