HTML Interview Questions & Answers (Detailed)
What is HTML?
HTML (HyperText Markup Language) is the standard language used to structure web pages. It
defines headings, paragraphs, images, links, forms and tables.
What is HTML5?
HTML5 is the latest version of HTML. It introduced semantic tags, audio, video, canvas, local
storage and improved browser support.
Difference between div and span?
div is a block-level element and starts on a new line. span is an inline element used inside text.
Difference between id and class?
id is unique and should identify one element. class can be reused on multiple elements.
What are semantic tags?
Semantic tags describe the meaning of content. Examples: header, nav, section, article and footer.
What is a form?
A form collects user input using controls like input boxes, checkboxes, radio buttons and buttons.
GET vs POST?
GET sends data in the URL. POST sends data in the request body and is more secure.
What is the alt attribute?
It provides alternative text for an image and improves accessibility.
What is the placeholder attribute?
It displays hint text inside an input field.
What is the required attribute?
It makes a form field mandatory before submission.
What is a table?
A table displays data in rows and columns using table, tr, th and td tags.
What is browser compatibility?
A webpage should work properly across browsers like Chrome, Firefox, Edge and Safari.