Top 50 HTML Interview Questions and
Answers
1. What is HTML?
HTML (HyperText Markup Language) is the standard markup language used to create web
pages. It structures the content using elements and tags.
2. What are HTML tags?
HTML tags are the building blocks of HTML. They define elements in a webpage and are
enclosed in angle brackets, e.g., <p>, <a>.
3. What is the difference between HTML and HTML5?
HTML5 is the latest version of HTML with new features like semantic tags (<article>,
<section>), multimedia support (<audio>, <video>), and local storage.
4. What are semantic HTML elements?
Semantic elements clearly describe their meaning in a human- and machine-readable way,
e.g., <header>, <footer>, <article>.
5. What is the purpose of the <!DOCTYPE html> declaration?
It defines the HTML version and ensures the browser renders the page in standards mode.
6. What is the use of the <head> tag?
The <head> tag contains metadata about the document, including title, character set, styles,
scripts, and links.
7. What is the <meta> tag used for?
The <meta> tag provides metadata like character encoding, author, description, and
viewport settings.
8. What is the difference between <div> and <span>?
<div> is a block-level container, while <span> is an inline container used for styling text or
small groups of elements.
9. What are void elements in HTML?
Void elements are self-closing tags that don't require a closing tag, e.g., <img>, <br>, <hr>.
10. What is the purpose of the <a> tag?
The <a> (anchor) tag creates hyperlinks to navigate within the site or to external pages.