HTML Lists Interview
Interview questions on unordered, ordered, and description lists with practical usage.
1Difference between
ul and ol?easyAnswer:
ul is unordered (bullet list), ol is ordered (numbered sequence).2When to use description list?easy
Answer: Use
dl, dt, dd for term-definition pairs or label-value content.3Can lists be nested?easy
Answer: Yes, place a child list inside a parent
li.4How to start ordered list at a custom number?medium
Answer: Use
<ol start="5">.5How to reverse ordered list numbering?medium
Answer: Use
<ol reversed>.6What does list semantics help with?medium
Answer: Accessibility, screen reader understanding, and clearer content structure.
7Why avoid using list tags for layout?medium
Answer: It breaks semantic meaning and harms maintainability.
8How to style bullets/numbers?easy
Answer: With CSS properties like
list-style-type and list-style-position.9Can one list item contain complex content?easy
Answer: Yes, each
li can include text, links, images, and nested blocks.10Best practice answer in interviews?medium
Answer: Pick list type by meaning: sequence ->
ol, group -> ul, term/value -> dl. Tricky Q&A (10 Questions)
11ol reversed attribute:tricky
Answer: Correct answer: Counts down. reversed makes ordered lists count downward.
12li value attribute on ol affects:tricky
Answer: Correct answer: Marker number for that item and following items. value sets numbering for a specific li in ol.
13Valid child of ul is:tricky
Answer: Correct answer: li. ul may contain li elements (and script-support).
14Description list term tag:tricky
Answer: Correct answer: dt. dt marks the term in a dl.
15Nested ul inside li is:tricky
Answer: Correct answer: Valid for hierarchical outlines. List nesting inside li is standard practice.
16CSS list-style-type replaces obsolete:tricky
Answer: Correct answer: ul type attribute. Prefer CSS over legacy type on ul.
17dl is best for:tricky
Answer: Correct answer: Name/value or term/definition pairs. dl suits glossaries and metadata pairs.
18Multiple dd elements after one dt:tricky
Answer: Correct answer: Allowed for multiple descriptions. One dt may have several dd elements.
19start on ol sets:tricky
Answer: Correct answer: First list item number. start defines the initial counter value.
20Using lists for nav improves:tricky
Answer: Correct answer: Screen reader list semantics and structure. Lists expose count and structure to assistive tech.