HTML Interview Questions: Forms, Tables and Media
Thirty questions on the areas interviewers use to separate people who have built real things from people who have read about them.
- SQL Interview
-
HTML Interview
- HTML Interview Questions: Fundamentals
- HTML Interview Questions: Forms, Tables and Media
- HTML Interview Questions: Semantics and Accessibility
- HTML Interview Questions: SEO, Performance and Tooling
- Scenario Based Interview Questions
- Rapid Fire and Fresher Round Questions
- Live Coding and Project Explanation Rounds
Why these questions separate candidates
Forms, tables and media are where markup gets difficult in real work, and interviewers know it. Someone who has only built static pages can usually answer the fundamentals; these questions are where the gap shows.
Questions only. Answer each in your own words, then verify in a browser.
Forms
- What is the difference between the
nameandidattributes on a form control? - A field has an
idbut noname. What reaches the server? - What is the difference between GET and POST as form methods? When is each correct?
- Is POST encrypted? Explain what actually protects form data.
- What does an unchecked checkbox submit? How would you guarantee a value?
- What makes a set of radio buttons one group?
- How many tab stops does a radio group occupy, and how do you move within it?
- What is the difference between
disabledandreadonly? - Why is
type="number"wrong for a phone number? - What is
inputmodefor, and how does it differ fromtype? - Why is a placeholder not a substitute for a label?
- Name three ways to associate a label with a control, and say which you prefer.
- What do
fieldsetandlegenddo, and when are they not optional? - What happens to a
buttoninside a form with notypeattribute? - What two things must a file upload form have?
- Is a hidden field secure? What should and should not go in one?
- Name four native validation attributes and what each checks.
- Why is client side validation not a security control?
- What does
novalidatedo, and why might you use it deliberately? - How would you display form errors accessibly?
- What is a CSRF token and why does a hidden field make it work?
Tables
- When should you use a table, and when should you not?
- What is the difference between
thandtdbeyond appearance? - Explain the column arithmetic
colspanandrowspanimpose. - What does the
scopeattribute do? Name its four values. - When would you need
headersandidinstead ofscope? - What does
captiongive a table? - Why use
theadandtbodyrather than plain rows? - How would you make an eight column table usable on a phone? Name two approaches and their trade offs.
Media
- Which attributes are required on an
img, and which are strongly advised? - Explain the difference between a missing
altandalt="". - Why do
widthandheightmatter when CSS controls the size? - Explain
srcsetandsizes. Why mustsizesbe declared? - When would you use
picturerather thansrcset? - What does
loading="lazy"do, and where must you never use it? - Why can autoplay video not have sound?
- What does the
trackelement do, and what is the difference between captions and subtitles? - What is required on an
iframefor accessibility? - What does the
sandboxattribute do, and what is the risk of combiningallow-scriptswithallow-same-origin? - When would you choose SVG over PNG, and what does inline SVG give you that an
imgdoes not?
The questions behind the questions
| They ask | They are checking |
|---|---|
Difference between name and id | Have you ever debugged a form that submitted nothing? |
| What an unchecked checkbox submits | Have you written server code that read one? |
| GET versus POST | Do you understand safe and idempotent, or only the examples? |
Why sizes is required | Do you know the browser chooses before CSS is applied? |
| Table spanning arithmetic | Have you built a complex table and had it tear? |
| Hidden field security | Do you understand that everything client side is editable? |
Practice
- Answer all forty out loud.
- Build a small demonstration for questions 5, 9, 24 and 33, and use them as examples.
- For every question you could not answer, find the note in this path and reread it.
- Ask someone to pick ten at random and answer without preparation.