Basic HTML Interview Questions


What is HTML?
HTML (HyperText Markup Language) is the standard language used to create and design the structure of web pages.
What are tags in HTML?
Tags are predefined keywords used to define elements in an HTML document. Example:
<p>
,<div>
,<h1>
.What is the difference between HTML and HTML5?
HTML5 is the latest version of HTML that supports new features like semantic elements, audio/video embedding, canvas, and local storage.
What is the purpose of the
<!DOCTYPE html>
declaration?It tells the browser that the document is HTML5 and helps it render the page correctly.
What are semantic HTML elements?
These are elements that clearly describe their meaning in a human- and machine-readable way. Examples:
<header>
,<footer>
,<article>
,<nav>
.What is the difference between
<div>
and<span>
?<div>
is a block-level element, used for grouping large sections;<span>
is inline, used for small parts within a text.What are void (self-closing) elements in HTML? Give examples.
Elements that do not have closing tags. Examples:
<img>
,<br>
,<hr>
,<input>
.What is the difference between
id
andclass
attributes?id
is unique and used for a single element.class
can be shared among multiple elements.What are the different types of lists in HTML?
Ordered List (
<ol>
), Unordered List (<ul>
), and Description List (<dl>
).What are block-level and inline elements?
Block-level elements take up the full width (e.g.,
<div>
,<p>
). Inline elements take up only as much width as needed (e.g.,<span>
,<a>
).
Subscribe to my newsletter
Read articles from Banashree Aribenchi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
