HTML Interview10 Q&A

HTML Tables Interview

Interview questions on table structure, semantics, accessibility, and common pitfalls.

1Main tags in an HTML table?easy
Answer: table, tr, th, and td.
2Purpose of thead, tbody, tfoot?medium
Answer: They segment table sections for clarity, styling, and accessibility.
3When to use th vs td?easy
Answer: th is header cell, td is data cell.
4What is scope attribute in th?medium
Answer: It defines if header applies to row/column, helping screen readers map data correctly.
5Use of caption in tables?easy
Answer: Provides table title/description, improving context for users.
6rowspan and colspan meaning?medium
Answer: They merge cells across rows or columns.
7Should tables be used for page layout?easy
Answer: No. Use tables for tabular data only; use CSS layout for page structure.
8How to make wide tables mobile-friendly?medium
Answer: Wrap in responsive container with horizontal scrolling and clear headings.
9Accessibility tip for complex tables?medium
Answer: Use proper headers, scope, captions, and consistent cell associations.
10Interview best-practice summary?medium
Answer: Semantic sections + accessible headers + no layout misuse.