Intermediate HTML Interview Questions & Answers


What is the difference between
<section>
,<article>
, and<aside>
?<section>
groups related content,<article>
is for self-contained pieces like blogs,<aside>
is for side content like ads or links.
What is the use of the
<meta>
tag?- Provides metadata about the HTML document, like charset, author, and viewport settings for responsiveness.
What is the purpose of the
alt
attribute in images?- Describes the image for screen readers and is shown when the image fails to load.
How can you embed audio and video in HTML5?
Use
<audio>
and<video>
tags. Example:<video controls><source src="movie.mp4" type="video/mp4"></video> <audio controls><source src="sound.mp3" type="audio/mpeg"></audio>
How do you create a hyperlink that opens in a new tab?
- Use
target="_blank"
in the anchor tag:<a href="url" target="_blank">Link</a>
- Use
What are global attributes in HTML?
- Attributes that can be used on any HTML element. Examples:
id
,class
,style
,title
,data-*
.
- Attributes that can be used on any HTML element. Examples:
What is the difference between
<strong>
and<b>
? Or<em>
and<i>
?<strong>
and<em>
have semantic meaning (important/emphasized), while<b>
and<i>
are just visual (bold/italic).
How do forms work in HTML? What elements are involved?
- Forms collect user input. Main elements:
<form>
,<input>
,<textarea>
,<button>
,<select>
,<label>
.
- Forms collect user input. Main elements:
What is the purpose of the
name
attribute in form elements?- It identifies form data when it is submitted to the server.
What is the difference between
localStorage
,sessionStorage
, andcookies
?localStorage
: Stores data with no expiration.sessionStorage
: Stores data until the tab is closed.cookies
: Can store small data with optional expiration, sent with each HTTP request.
Subscribe to my newsletter
Read articles from Banashree Aribenchi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
