Preparing for HTML interviews or strengthening your web development fundamentals? This HTML MCQs collection covers document structure, elements, attributes, forms, semantic HTML, accessibility, HTML5 APIs, and browser behavior. Use these multiple-choice questions to assess your knowledge and identify topics to revise.
Note: Score 60% or higher to unlock an exclusive offer of up to 50% off on all self-paced HTML and Web Development courses.
Let's begin!
1. What does HTML stand for?
2. What is the primary purpose of HTML?
3. Which declaration identifies an HTML5 document?
4. Which element is the root element of an HTML page?
5. Which element contains metadata and resource references?
6. Which element contains visible page content?
7. Which element sets the page title shown in the browser tab?
8. Which heading element represents the highest-level heading?
9. Which element creates a paragraph?
10. Which syntax represents an HTML comment?
11. What is an HTML element generally made up of?
12. Which statement about HTML is correct?
13. What is an HTML attribute used for?
14. Which attribute uniquely identifies an element within a document?
15. Which attribute can be shared by multiple elements for styling or scripting?
16. Which attribute specifies the destination of a hyperlink?
17. Which attribute specifies the path to an image file?
18. What is the purpose of the alt attribute on an image?
19. Which attribute opens a link in a new browsing context when set to _blank?
20. Which attribute provides advisory text often shown as a tooltip?
21. Which attribute makes a form control non-editable and non-submittable?
22. Which attribute requires a form field to be completed before submission?
23. Which attribute is commonly used to associate a label with a form control?
24. What does the content attribute of a meta element provide?
25. Which element creates a hyperlink?
26. Which element embeds an image in a page?
27. Which element is used to play video content?
28. Which element embeds audio content?
29. Which attribute displays built-in playback controls for audio or video?
30. Which element provides alternative media sources for a video or audio element?
31. Which element provides captions or subtitles for media?
32. What does a relative URL usually reference?
33. Which link type is commonly used to navigate to a section on the same page?
34. Which protocol prefix is used for an email link?
35. What is the purpose of the download attribute on an anchor element?
36. Which element can offer multiple image sources for responsive image selection?
37. Which element creates an unordered list?
38. Which element creates an ordered list?
39. Which element represents an individual list item?
40. Which element represents a table row?
41. Which element represents a standard table data cell?
42. Which element represents a header cell in a table?
43. Which attribute allows a table cell to span multiple columns?
44. Which attribute allows a table cell to span multiple rows?
45. Which element groups the header rows of a table?
46. Which element groups the main data rows of a table?
47. Which element provides a title or caption for a table?
48. Which elements are used for a description list?
49. Which element creates an HTML form?
50. Which input type is intended for email addresses?
51. Which input type hides the characters entered by the user?
52. Which input type allows a user to select one option from a group when options share a name?
53. Which input type allows independent selection of multiple choices?
54. Which element creates a drop-down selection control?
55. Which element defines an option inside a select element?
56. Which element provides a multi-line text input?
57. Which button type submits a form by default?
58. Which attribute specifies the URL that processes form data?
59. Which form method typically appends submitted data to the URL query string?
60. What is the purpose of the name attribute on a successful form control?
61. What is the main benefit of semantic HTML?
62. Which element represents introductory content or a group of navigational aids?
63. Which element is intended for a page or section navigation block?
64. Which element represents the dominant content of the document?
65. Which element is suitable for a self-contained composition that could stand independently?
66. Which element represents content indirectly related to the surrounding content?
67. Which element represents a thematic grouping of content, typically with a heading?
68. What does the lang attribute on the html element help identify?
69. Which practice improves accessibility for form controls?
70. What is the purpose of ARIA attributes?
71. Which element is generally preferred for a clickable action that performs an operation?
72. Why should heading levels follow a logical hierarchy?
73. Which element provides a scriptable bitmap drawing area?
74. Which technology describes scalable vector graphics in markup?
75. Which API stores key-value data in the browser with no automatic expiration?
76. When is sessionStorage data generally cleared?
77. Which API can request a user’s geographic location, subject to permission?
78. Which HTML element can display a disclosure widget that users can open and close?
79. Which element provides the visible summary for a details element?
80. Which element represents a dialog box or modal-like interactive component?
81. Which attribute can make a dialog initially open?
82. Which element represents a scalar measurement within a known range?
83. Which element represents task completion progress?
84. Which attribute can defer execution of an external classic script until after parsing?
85. Which meta declaration sets the document character encoding?
86. Which meta tag is commonly used to configure a responsive viewport?
87. Which element links an external CSS file?
88. Which element embeds JavaScript in or links it to an HTML document?
89. Which attribute specifies the external script file location?
90. What is the purpose of the base element?
91. Which element defines machine-readable metadata about the document?
92. Which element identifies the main content of a figure, often paired with a caption?
93. Which element supplies a caption for a figure?
94. Which element marks text as highlighted or relevant?
95. Which element represents a date or time value?
96. Which attribute on a time element can provide a machine-readable date/time value?
97. Which attribute applies inline CSS declarations to an element?
98. Which element contains embedded CSS rules?
99. Which attribute connects an HTML element to one or more CSS classes?
100. Which selector targets an element with id="header"?
101. Which selector targets elements belonging to class="card"?
102. Where is an external stylesheet normally referenced?
103. What is the usual purpose of the rel="stylesheet" value?
104. Which HTML element is a generic block-level container with no semantic meaning?
105. Which HTML element is a generic phrasing-level container with no semantic meaning?
106. Which attribute can be used to apply a CSS custom data hook without adding a class?
107. Which approach is generally best for styling many pages consistently?
108. What does the hidden attribute do?
109. What is the purpose of validating HTML?
110. Why should important images have descriptive alt text?
111. Which practice helps create descriptive hyperlinks?
112. Why should an HTML document generally contain one main element?
113. Which element should be used for the document’s primary heading where appropriate?
114. What is a common consequence of duplicate id values in one document?
115. Which practice is best for HTML character encoding?
116. What is the role of a canonical link element?
117. Which attribute helps prevent a new-tab link from gaining access to the opener in supported contexts?
118. Why should deprecated HTML elements generally be avoided?
119. What is the benefit of using native HTML controls where possible?
120. Which tool can help check whether HTML follows web standards?
121. What does the DOM represent?
122. Which JavaScript method commonly selects an element by its CSS selector?
123. What does the defer attribute do for an external classic script?
124. How does async differ from defer for classic external scripts?
125. What event fires when the initial HTML document has been completely parsed?
126. What does the sandbox attribute on an iframe provide?
127. Which attribute on an iframe can provide a descriptive title for assistive technology?
128. What is the purpose of the srcdoc attribute on an iframe?
129. Which attribute can allow an input to accept multiple files when used with type="file"?
130. Which attribute can provide suggested values for an input through a datalist?
131. What does the contenteditable global attribute enable?
132. Which attribute can define a keyboard shortcut for an element?