HTML Interview Questions
What Is It?
An interview answer is easier to remember when you can show a small example. Start with these three questions, then open the optional question list below.
What the Tags Mean
- What is HTML? A language for describing page content.
- What is a tag? A marker such as <p> that names a kind of content.
- What is an attribute? Extra information inside an opening tag.
Example 1
Save each example as index.html and open it in your browser. Each code block is a complete page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Interview Questions</title>
</head>
<body>
<p class="note">Hello!</p>
</body>
</html>Browser preview
What you see: p is the tag name. Hello! is the content. class="note" is an attribute. Together they make a paragraph element.
Example 2: Another Use
Can you explain a link? The href attribute says where the link goes.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Interview Questions</title>
</head>
<body>
<a href="#answer">Read the answer</a>
<p id="answer">This is the destination.</p>
</body>
</html>Browser preview
Simple Tip
Answer in your own words. A short correct explanation is better than a memorized long paragraph.
Try It Yourself
Explain the difference between a heading, a paragraph, and a link.