HTML Interview Questions & Answers (Freshers)
1. What is HTML?
HTML is a markup language used to create the structure of web pages.
2. Why is HTML used?
To structure content like text, images, links, and forms.
3. What are HTML tags?
Tags define elements and are enclosed in angle brackets.
4. Difference between HTML and HTML5?
HTML5 supports audio, video, semantic tags, and local storage.
5. What are empty elements?
Elements without closing tags like br, hr, img, input.
6. What is an attribute?
Attributes provide extra information about elements.
7. Difference between div and span?
Div is block-level, span is inline.
8. What are semantic elements?
Elements that describe their meaning like header, footer, section.
9. What is DOCTYPE?
It tells the browser the document type is HTML5.
10. Difference between block and inline elements?
Block takes full width, inline takes content width.
11. What is a form?
Used to collect user input.
12. Difference between id and class?
Id is unique, class can be reused.
13. What is alt attribute?
Provides alternative text for images and accessibility.
14. What is iframe?
Used to embed another webpage.
15. Is HTML case sensitive?
No, but lowercase is recommended.