HTML - Q & A

100 HTML Interview Questions & Answers

100 HTML Interview Questions & Answers

HTML Basics

Q1. What is HTML?

HTML stands for HyperText Markup Language.

Q2. Purpose of HTML?

To structure web pages.

Q3. HTML file extension?

.html or .htm

Q4. Basic HTML structure?
<!DOCTYPE html>
<html>
<head></head>
<body></body>
</html>
Q5. What is <!DOCTYPE>?

Defines HTML version.

Q6. What is a tag?

HTML instruction inside < >

Q7. What is an element?

Start tag + content + end tag.

Q8. What are attributes?

Provide extra information.

Q9. Heading tags?

<h1> to <h6>

Q10. Paragraph tag?
<p>Text</p>
Q11. Line break tag?
<br>
Q12. Horizontal rule?
<hr>
Q13. Bold text?
<b>Bold</b>
Q14. Italic text?
<i>Italic</i>
Q15. Underline?
<u>Text</u>
Q16. Anchor tag?
<a href="#">Link</a>
Q17. Image tag?
<img src="img.jpg">
Q18. alt attribute?

Text if image fails.

Q19. Ordered list?
<ol><li>Item</li></ol>
Q20. Unordered list?
<ul><li>Item</li></ul>
Q21. Table tag?
<table></table>
Q22. Table row?
<tr>
Q23. Table data?
<td>
Q24. Table header?
<th>
Q25. Comment?
<!-- comment -->

Intermediate HTML

Q26. Block vs inline?

Block takes full width; inline doesn't.

Q27. Inline elements?

<span>, <a>

Q28. Block elements?

<div>, <p>

Q29. div tag?

Generic block container.

Q30. span tag?

Inline container.

Q31. Form tag?
<form></form>
Q32. Input tag?
<input type="text">
Q33. Textarea?
<textarea></textarea>
Q34. Button tag?
<button>Click</button>
Q35. Label tag?
<label>Name</label>
Q36. Required attribute?
required
Q37. Placeholder?
placeholder="Enter name"
Q38. Disabled input?
disabled
Q39. Readonly?
readonly
Q40. Checkbox?
<input type="checkbox">
Q41. Radio button?
<input type="radio">
Q42. Select dropdown?
<select><option></option></select>
Q43. Multiple select?
multiple
Q44. File upload?
<input type="file">
Q45. Email input?
<input type="email">
Q46. Password input?
<input type="password">
Q47. Date input?
<input type="date">
Q48. Number input?
<input type="number">
Q49. Hidden input?
<input type="hidden">
Q50. iframe?
<iframe src="url"></iframe>
Q51. Audio tag?
<audio controls></audio>
Q52. Video tag?
<video controls></video>
Q53. controls attribute?

Shows media controls.

Q54. autoplay?

Auto plays media.

Q55. Semantic HTML?

Meaningful tags.

Q56. header tag?
<header>
Q57. footer tag?
<footer>
Q58. section tag?
<section>
Q59. article tag?
<article>
Q60. nav tag?
<nav>

Advanced & Interview HTML

Q61. HTML5?

Latest HTML standard.

Q62. Advantages of HTML5?

Semantic, multimedia support.

Q63. Meta tag?
<meta>
Q64. Charset?
<meta charset="UTF-8">
Q65. Viewport?
<meta name="viewport">
Q66. SEO meta description?
<meta name="description">
Q67. Favicon?
<link rel="icon">
Q68. Language attribute?
<html lang="en">
Q69. Data attributes?
data-id="1"
Q70. Contenteditable?
contenteditable="true"
Q71. Download attribute?
download
Q72. target="_blank"?

Opens new tab.

Q73. rel="noopener"?

Security feature.

Q74. Canvas tag?
<canvas>
Q75. SVG?

Scalable Vector Graphics.

Q76. Figure tag?
<figure>
Q77. Figcaption?
<figcaption>
Q78. Time tag?
<time>
Q79. Progress bar?
<progress>
Q80. Meter tag?
<meter>
Q81. Details & summary?
<details><summary>
Q82. Noscript?
<noscript>
Q83. Accessibility?

ARIA, labels.

Q84. ARIA?

Accessible Rich Internet Apps.

Q85. Role attribute?

Defines element role.

Q86. Tabindex?
tabindex="0"
Q87. HTML entities?
&lt; &gt;
Q88. Self-closing tags?

<br>, <img>

Q89. Deprecated tags?

<font>, <center>

Q90. Inline CSS allowed?

Yes but avoid.

Q91. External CSS?

Best practice.

Q92. Script tag?
<script>
Q93. async vs defer?

Script loading control.

Q94. HTML validation?

Checks syntax errors.

Q95. HTML parser?

Browser interprets HTML.

Q96. Rendering engine?

Displays web pages.

Q97. DOM?

Document Object Model.

Q98. HTML vs XHTML?

XHTML stricter.

Q99. Best HTML practice?

Semantic, accessible, clean.

Q100. HTML interview tip?

Know semantics & forms well.

No comments:

Post a Comment