HTML & CSS Interview Question #6

What are HTML elements, tags, and attributes?

HTML Fundamentals, Structure, Semantics, Links, Images, Tables & Forms Junior Beginner

Quick Interview Answer

An HTML element is a component of the document, usually represented by a start tag, content, and an end tag. A tag is the markup syntax used to declare an element, such as <p> or </p>.

Detailed Explanation

An HTML element is a component of the document, usually represented by a start tag, content, and an end tag. A tag is the markup syntax used to declare an element, such as <p> or </p>.

Attributes provide additional information or configuration for an element. They appear in the start tag, for example href on an anchor or src and alt on an image.

Code Example

<a href="/interview" class="nav-link">
    Interview Preparation
</a>

<img src="/images/html.png"
     alt="HTML logo">