Comments, Tags v/s Elements and Attribute

Introduction to HTML Comments

HTML comments are a way to add notes and explanations to your HTML code without them being visible to users when the page is rendered in a web browser. 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 comments to your HTML code by enclosing them within the <!-- and --> tags.

HTML Tags

In HTML, tags are used to define the structure and layout of a webpage. They are the basic building blocks that are used to create elements on a page. For example, the <p> tag is used to create a paragraph element, while the <h1> tag is used to create a heading element. The tag may appear in pairs, with an opening tag and a closing tag, like this: <tag>Content</tag> or sometimes self-closing like: <tag/>.

HTML Elements

Elements are the individual components of an HTML document, such as headings, paragraphs, and images. Each element is represented by a corresponding HTML tag. For example, a paragraph element is represented by the <p> tag, and a heading element is represented by the <h1>, <h2>, etc. tags. The element content is the content between the opening and closing tags.

HTML Attributes

Attributes are used to provide additional information 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, and the href attribute is used to specify the destination of a link.