HTML & CSS Interview Question #12
What are the HTML heading elements and how should they be used?
HTML Fundamentals, Structure, Semantics, Links, Images, Tables & Forms Junior Beginner
Quick Interview Answer
HTML provides h1 through h6 heading elements. They represent headings at different levels in the document hierarchy, with h1 representing the highest level and h6 the lowest.
Detailed Explanation
HTML provides h1 through h6 heading elements. They represent headings at different levels in the document hierarchy, with h1 representing the highest level and h6 the lowest.
Headings should describe the logical structure of the content rather than being selected only for their default font size. CSS should control visual appearance. A clear heading hierarchy also improves navigation for screen-reader users.
Code Example
<h1>JavaScript Interview Questions</h1>
<h2>JavaScript Fundamentals</h2>
<h3>Variables and Scope</h3>
<h2>Asynchronous JavaScript</h2>
<h3>Promises</h3>