HTML Interview Questions and Answers
1. What is HTML?
HTML stands for HyperText Markup Language. It is the standard language used to create web pages.
2. What are HTML tags?
HTML tags are keywords enclosed in angle brackets like <tagname>. They define elements on a webpage.
3. What is the difference between <div> and <span>?
<div> is a block-level element. <span> is an inline element.
4. What is the difference between HTML and HTML5?
HTML5 is the latest version. It supports new elements like <audio>, <video>, and works better for mobile
devices.
5. What is semantic HTML?
Semantic HTML uses tags that describe the meaning of the content, like <header>, <footer>, <nav>.
6. What is the use of the <meta> tag?
The <meta> tag provides metadata about the HTML document.
7. What is the difference between id and class?
id is unique and used for one element. class can be reused for multiple elements.
8. What is the use of the alt attribute in <img> tag?
The alt attribute provides alternative text for an image if it fails to load.
HTML Interview Questions and Answers
9. What is a hyperlink in HTML?
A hyperlink is created using the <a> tag to link to another page or site.
10. What are empty (void) elements in HTML?
Empty elements do not have a closing tag. Examples: <br>, <hr>, <img>, <input>.