InterviewQs

Top 25 HTML Interview Coding Questions

High-frequency HTML coding questions used in real frontend interviews.

1.Basic HTML page structure

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>My Page</title>
</head>
<body>
  <h1>Hello World</h1>
</body>
</html>

2.HTML5 semantic layout

<header></header>
<nav></nav>
<main>
  <section></section>
  <article></article>
</main>
<footer></footer>

3.Create a hyperlink

<a href="https://example.com" target="_blank">
  Visit Website
</a>

4.Image with alt attribute

<img src="image.jpg" alt="Description">

5.Ordered and unordered lists

<ul>
  <li>HTML</li>
  <li>CSS</li>
</ul>

<ol>
  <li>JavaScript</li>
  <li>Python</li>
</ol>

6.Create a table

<table>
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>John</td>
    <td>25</td>
  </tr>
</table>

7.HTML form

<form>
  <input type="text" placeholder="Name">
  <input type="email" placeholder="Email">
  <button type="submit">Submit</button>
</form>

8.Input types

<input type="email">
<input type="date">
<input type="number">

9.Label with input

<label for="email">Email</label>
<input id="email" type="email">

10.Audio element

<audio controls>
  <source src="song.mp3" type="audio/mpeg">
</audio>

11.Video element

<video controls width="300">
  <source src="video.mp4" type="video/mp4">
</video>

12.Iframe example

<iframe src="page.html"></iframe>

13.Meta viewport

<meta name="viewport" content="width=device-width, initial-scale=1.0">

14.HTML comment

<!-- This is a comment -->

15.Download attribute

<a href="file.pdf" download>Download</a>

16.Figure and figcaption

<figure>
  <img src="img.jpg">
  <figcaption>Caption</figcaption>
</figure>

17.Details and summary

<details>
  <summary>More Info</summary>
  <p>Hidden text</p>
</details>

18.Progress bar

<progress value="70" max="100"></progress>

19.Required field

<input type="text" required>

20.Placeholder

<input type="text" placeholder="Enter name">

21.Block vs inline

<div>Block</div>
<span>Inline</span>

22.HTML entities

&copy; &lt; &gt; &amp;

23.Open link new tab

<a href="page.html" target="_blank">Open</a>

24.Form textarea

<textarea placeholder="Message"></textarea>

25.Semantic section

<section>
  <h2>Title</h2>
  <p>Content</p>
</section>
InterviewQs – Professional Footer