HTML Cheat Sheet for Beginners
HTML Cheat Sheet for Beginners
Search...
HTML (HyperText Markup Language) serves as the foundational framework for web pages, structuring content like text, images, and videos. HTML forms
the backbone of every web page, defining its structure, content, and interactions. Its enduring relevance lies in its universal adoption across web
development, ensuring that regardless of the framework or language used, content ultimately renders in HTML.
This HTML Cheat Sheet for Beginners contains helpful code examples and is designed as a quick reference for those familiar with these languages. From
semantic elements to mobile optimization, we covered all topics. Whether you’re building a personal blog, an e-commerce site, or a cutting-edge web app,
this cheat sheet has you covered.
Main root
The <html> element represents the root (top-level element) of an HTML document also called the document element. All other elements must be
descendants of this element.
<html> … </html>
Boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Description of the document -->
<meta charset="UTF-8" />
<title>
<!-- title goes here -->
Geeks For Geeks
</title>
</head>
<body>
<!-- your content goes here -->
Welcome to Geeks for Geeks
</body>
</html>
Headings
HTML heading tags (<h1> to <h6>) are used to define headings and subheadings on your webpage.
The <h1> tag is typically reserved for the page’s main title, while the others denote subheadings in descending order of importance.
<h1> Used for title generally once per page and has a font size of 2em. <h1>....</h1>
<h2> Used for medium sized titles and has a font size of 1.5em. <h2>....</h2>
<h3> Used for subsections and has a font size of 1.17em. <h3>....</h3>
<h4> Used for highlighting text with font size of 1em. <h4>....</h4>
<h6> Displays least significant details and has a font size of .67em <h6>....</h6>
<!DOCTYPE html>
<html>
[Link] 1/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<head>
<title>Heading Tags</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>GeeksforGeeks</h2>
<h3>GeeksforGeeks</h3>
<h4>GeeksforGeeks</h4>
<h5>GeeksforGeeks</h5>
<h6>GeeksforGeeks</h6>
</body>
</html>
Container
Container tags in HTML are used to group other elements together. They provide a way to structure your HTML and apply styles to multiple elements at
once. The several container tags in HTML are:
<div> Block element that defines a division in HTML document. <div>... </div>
<pre> Represents pre-formatted text to present exactly as written in the HTML file. <pre>...</pre>
<!DOCTYPE html>
<html>
<head>
<title> GeeksforGeeks </title>
<meta name="keywords" content="Meta Tags, Metadata" />
<meta name="description" content="Geeksforgeeks is a computer science portal." />
<style type="text/css">
body {
background-color: powderblue;
}
h1 {
color: black;
font-family: arial;
}
</style>
</head>
<body>
<p>
GeeksforGeeks is a
<!-- span tag starts-->
<span style="color:red;font-weight:bolder">
computer science</span> portal for
<span style="background-color: lightgreen;">
geeks
</span>
<!-- span tag ends -->
<!-- pre tag starts here -->
<pre>
This
is a pre tag.
</pre>
</p>
<!-- html pre tag ends here -->
<!--code Tag starts here -->
code tag: Displays code snippets.
<code>
#include<stdio.h>
int main() {
printf("Hello Geeks");
}
<!--code Tag ends here -->
</code>
<p>
Click on the following link
<!-- anchor tag starts -->
<a href="[Link]
GeeksforGeeks
</a>
<!-- anchor tag ends -->
[Link] 2/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
</p>
</body>
</html>
Document Information
This section encompasses HTML tags that provide a comprehensive summary of the content within the HTML document. These tags offer a snapshot of
what the document contains, enhancing the understanding of its structure and content.
<!DOCTYPE html>
<html>
<!-- head tag starts here -->
<head>
<!-- title tag -->
<title>Title goes here </title>
.second {
text-align: center;
background-color: white;
font-size: 30px;
color: red;
}
</style>
<!-- style tag ends here -->
</head>
<!-- head tag ends here -->
<body>
<p id="first">Hello GeeksforGeeks.</p>
<p class="second">Welcome Geeks</p>
</body>
</html>
Semantic Element
Semantic Element in HTML are elements that clearly describe their meaning in terms of content and function, both to the browser and the developer.
<header> Used to give introductory content about the document. <header>... </header>
<section> Structural HTML element used to group together related elements. <section>... </section>
<article> Represents a self-contained composition which is independently distributable or reusable. <article>... </article>
<aside> Defines some content aside from the content it is placed in. <aside>... </aside>
<footer> Represents a footer for its sectioning root element <footer>... </footer>
[Link] 3/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<!DOCTYPE html>
<html>
<body>
<h3>HTML Header Tag</h3>
<hr>
<article>
<!-- header tag starts -->
<header>
<h3>GeeksforGeeks Learning</h3>
<h3> HTML nav Tag</h3>
<!-- nav tag starts -->
<nav>
<a href="#">Home</a> |
<a href="#">Interview</a> |
<a href="#">Languages</a> |
<a href="#">Data Structure</a> |
<a href="#">Algorithm</a>
</nav>
<!-- nav tag ends -->
</header>
<!-- header tag ends -->
</article>
<!-- main tag starts here -->
<main>
<!-- HTML section tag is used here -->
<section>
<h1>Geeksforgeek: Section 1</h1>
<p>Content of section </p>
</section>
<!-- HTML section tag ends here -->
<!-- aside tag starts here -->
<aside>
<h1>This is heading text in aside Tag</h1>
<p>This is paragraph text in aside Tag</p>
</aside>
<!-- aside tag ends here -->
</main>
<!-- main tag ends here -->
<!--HTML footer tag starts here-->
<footer>
<article>
<!-- address tag starts from here -->
<address>
Organization Name: GeeksforGeeks <br>
Web Site:
<a href="[Link]
GeeksforGeeks</a><br>
visit us:<br>
GeeksforGeeks<br>
A-118, Sector 136, Noida, <br>
Uttar Pradesh (201305)
</address>
<!-- address tag ends here -->
</article>
<br>
<a href="[Link]
About Us
</a>|
<a href="[Link]
Privacy Policy
</a>|
<a href="[Link]
Careers
</a>
<p>@geeksforgeeks, Some rights reserved</p>
</footer>
<!-- footer tag ends here -->
</body>
</html>
<em> Used to put stress on some text or show some degree of emphasis. <em>...</em>
[Link] 4/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<!DOCTYPE html>
<html>
<head>
<title> Geeks for Geeks </title>
</head>
<body>
<!-- emphasis -->
<div><em>Emphasized text</em></div>
<!-- strong -->
<div><strong>Important text!</strong></div>
<!-- subscript -->
<div>GFG<sub>subscript text</sub></div>
<!-- superscript -->
<div>GFG<sup>Superscript text</sup></div>
<!-- abbreviation -->
<div><abbr>Abbreviation</abbr></div>
<!-- mark -->
<div><mark>Highlighted text</mark></div>
<!-- cite -->
<div><cite>Title of creative work</cite></div>
<!-- time -->
<div>Time<time>9:00 am</time>
to <time>7:00 pm</time>
</div>
</body>
</html>
Lists
List tags in HTML, including <ul>, <ol>, and <li>, are used to create different types of lists. It can be either numerical, alphabetic, bullet, or other symbols.
There are three list types in HTML:
<ol> The HTML <ol> element represents an ordered list of items. <ol>...</ol>
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
<body>
<h2>Welcome To GeeksforGeeks Learning</h2>
<h5>Unordered List</h5>
<!-- Unordered List -->
<ul>
<li>Data Structures & Algorithm</li>
<li>Web Technology</li>
<li>Aptitude & Logical Reasoning</li>
</ul>
[Link] 5/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<h5>Ordered List</h5>
<!-- Ordered List -->
<ol>
<li>Array</li>
<li>Linked List</li>
<li>Stacks</li>
</ol>
<h5>Description List</h5>
<!-- Description List -->
<dl>
<dt>Courses:</dt>
<dd>100 </dd>
<dt> Quizes:</dt>
<dd> 500 </dd>
<dt> Interview Experiences:</dt>
<dd>1000 </dd>
</dl>
</body>
</html>
Tables
Table tags in HTML, such as <table>, <tr>, <td>, and <th>, are used to create and structure tables in HTML. They allow you to present data in rows and
columns.
<thead> Used to provide a header to the group of content in an HTML table <thead>…</thead>
<tfoot> Defines a set of rows summarizing the columns of the table. <tfoot>…</tfoot>
<!DOCTYPE html>
<html>
<head>
<title>HTML Table</title>
</head>
<body>
<!-- table starts here -->
<table>
<!-- Table Caption -->
<caption>Geeks For Geeks Learning</caption>
<!-- Table row starts -->
<tr>
<!--Headers -->
<th>Programming Languages</th>
<th>Development</th>
</tr>
<!-- Table row ends -->
<tr>
<!-- Table data -->
<td>C programming </td>
<td>Full stack development</td>
</tr>
<tr>
<td>Java programming</td>
<td>Backend development</td>
</tr>
<tr>
<td>Angular </td>
<td>Frontend Development</td>
</tr>
<!-- Table Footer starts here -->
<tfoot>
<tr>
<td>Footer content</td>
</tr>
</tfoot>
<!-- Table footer ends here -->
</table>
[Link] 6/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
</body>
</html>
Forms
An HTML form is a section of a document that acts as a container for different types of input elements, such as text fields, passwords, menus, checkboxes,
radio buttons, submit buttons, etc.
Generally, Form tags in HTML, like <form>, <input>, <textarea>, and <button>, are used to create forms for user input.
<select> Represents a control that provides a menu of options to select from. <select>...</select>
<datalist> Used to give predefined options for an <input> element and adds an autocomplete feature to it. <datalist>...</datalist>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GfG</title>
</head>
<body>
<form>
HTML Cheat Sheet <fieldset>
CSS Cheat Sheet JS Cheat Sheet Bootstrap Cheat Sheet jQuery Cheat Sheet Angular Cheat Sheet SDE Sheet Facebook SDE Sheet Amazon SDE Sheet Apple SDE Sheet Netflix SD
<legend>Personal Details</legend>
<p>
<p>select used here:</p>
<!-- label starts -->
<label>
Salutation
<br />
<!-- select starts -->
<select name="salutation">
<option>--None--</option>
<option>Mr.</option>
<option>Ms.</option>
<option>Mrs.</option>
</select>
<!-- select ends -->
</label>
<!-- label ends -->
</p>
<p>
<label>First name:
<input name="firstName" placeholder="input element used here" />
</label>
</p>
<p>
<label>Last name: <input name="lastName" /></label>
</p>
<p>
Gender :
<label>
<input type="radio" name="gender" value="male" /> Male
</label>
<label>
<input type="radio" name="gender" value="female" /> Female
</label>
</p>
<label Language preferred: </label>
<input list="lang" placeholder="datalist used here">
<!--datalist Tag starts here -->
[Link] 7/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<datalist id="lang">
<option value="java"></option>
<option value="reactjs"></option>
<option value="php"></option>
<option value="python"></option>
</datalist>
<!--datalist Tag ends here -->
<p>
<label>Email:
<input type="email" name="email" />
</label>
</p>
<p>
<label>Date of Birth:
<input type="date" name="birthDate"/>
</label>
</p>
<p>
<!-- HTML address tag -->
<label>
Address :
<br />
<!--Textarea -->
<textarea name="address"
placeholder="Textarea used here">
</textarea>
</label>
</p>
<p>
<button type="submit">Submit</button>
</p>
<p>Progress tag used here:</p>
Downloading progress for your profile:
<!--HTML progress tag starts here-->
<progress value="57" max="100" placeholder="progress tag used here">
</progress>
<!--HTML progress tag ends here-->
</fieldset>
</form>
</body>
</html>
Multimedia
Multimedia tags in HTML, such as <img>, <audio>, and <video>, are used to embed multimedia content like images, audio files, and videos into your
webpage.
<video> Embeds a media player which supports video files in the document. <video>...</video>
<figure> Groups various diagrams, images, illustrations, and code snippets into the document. <figure>...</figure>
<object> Includes objects, such as images, audio, videos, and Portable Document Format (PDF) on a Web page. <object>...</object>
<!DOCTYPE html>
<html>
[Link] 8/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<source src="myvid.mp4" type="video/mp4">
<source src="[Link]" type="video/ogg">
</video>
<!-- Video tag ends here -->
<p> HTML Figure here</p>
<!--HTML figure tag starts here-->
<figure>
<img src=
"[Link]
width="304" height="228" alt="The Pulpit Rock">
<figcaption>Figure Caption goes here </figcaption>
</figure>
<!--HTML figure tag ends here-->
<p> HTML Object here</p>
<!--HTML object tag starts here-->
<object data=
"[Link]
width="550px" height="150px">
GeeksforGeeks
<!--HTML object tag ends here-->
</object>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Characters and Symbols</title>
</head>
<body>
<!-- Characters and Symbols are use inside of p element -->
<p>This is the sign of copyright: © </p>
<p>This is the sign of trademark: ™ </p>
<p>This is the sign of ampersand: @ </p>
<p>This is the sign of dollar : $ </p>
<p>This is the sign of less than : < </p>
<p>This is the sign of greater than : > </p>
<p>This is the sign of quotation mark : " </p>
</body>
</html>
Attributes
Attributes in HTML are used to provide additional information about HTML elements. They are always specified in the start tag and usually come in
name/value pairs like name="value". The name is the property you want to set and the value is the desired value of the attribute.
alt Used in the image tag to specify the alternative text of the image < tag_name alt ="..." >
src Specifies URL of the image to be used. < tag_name src ="..." >
width Specifies the width of the image in pixels. < tag_name width ="..." >
height Specifies the height of the image in pixels. < tag_name height ="..." >
[Link] 9/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
style Helps to change the look and feel of the document. < tag_name style ="..." >
id Unique identifier used to specify an area of a webpage. < tag_name id ="..." >
class Specifies one or more class names for an element. < tag_name class ="..." >
title Specifies extra information about an element. < tag_name title ="..." >
Placeholder Specifies a short hint that describes the expected value of an input field/text area <tag_name placeholder=" ">
<!DOCTYPE html>
<html>
<head>
<title>HTML Attributes</title>
<style>
#geeks {
background-color: green;
color: white;
}
.gfg {
background-color: white;
font-size: 30px;
color: red;
}
</style>
</head>
<body>
<!-- source attribute-->
<div>
<p>source attribute:</p>
<img src=
"[Link]
</div>
<!--Alternative text: alt attribute -->
<div><img src=
"[Link]
alt="Alternative text here">
</div>
<br>
<!-- Link: href attribute-->
<a href="[Link]
Click to open in the same tab
</a>
<br>
<a href="[Link] target="_blank">
Click to open in a different tab
</a>
<!-- id attribute-->
<h2 id="geeks">
Styling using id attribute here
</h2>
</body>
</html>
Link Tags
Link tags are used to define hyperlinks, which allow users to navigate between pages or sections within a webpage.
[Link] 10/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<a> Defines a hyperlink (used for linking to other pages or sections). <a href="URL">Link Text</a>
<link> Defines the relationship between the document and an external resource (usually for stylesheets) <link rel="stylesheet" href="[Link]">
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Link Tags Example</title>
<!-- Base tag to specify base URL for relative links -->
<base href="[Link]
<a href="[Link]">Go to Page</a> <!-- This will link to [Link] -->
</body>
</html>
onmouseover Occurs when the mouse pointer is moved over an element. <div onmouseover="changeColor()">Hover Me</div>
onchange Occurs when the value of an element changes. <input type="text" onchange="alert('Changed!')">
onload Occurs when a page or image has loaded. <img src="[Link]" onload="alert('Loaded!')">
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Event Example</title>
<script>
// Function to handle the click event
function showClickAlert() {
alert("You clicked the button!");
}
[Link] 11/13
7/7/25, 6:10 PM HTML Cheat Sheet - GeeksforGeeks
<button onclick="showClickAlert()">Click Me!</button>
Efficient Web Development: An HTML Cheat Sheet provides a quick reference guide for web developers, enabling faster and more efficient coding. It
helps in reducing the time spent on searching for syntax or tags, thereby increasing productivity.
Comprehensive Tag Reference: The cheat sheet includes an extensive collection of HTML tags and attributes, covering everything from basic structure
tags to complex interactive elements. This makes it a valuable resource for both beginners and experienced developers.
Semantic Understanding: With the inclusion of semantic tags in the cheat sheet, developers can create more meaningful and accessible web content. It
aids in understanding the structure and content of web pages better.
Interoperability: HTML is the foundational language of the web. An HTML Cheat Sheet can be beneficial when working with other web technologies like
CSS, JavaScript, and various web development frameworks.
Optimized for SEO: A well-structured HTML document using the correct tags and attributes can significantly improve SEO. The cheat sheet can guide
developers in creating SEO-friendly markup.
Multimedia Integration: The cheat sheet covers tags for embedding multimedia elements like images, audio, and video into web pages, enabling richer
and more interactive web content.
Remember, using an HTML Cheat Sheet can greatly enhance your web development process, making it a must-have tool for every web developer.
HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps. You can learn HTML from the ground up by
following this HTML Tutorial and HTML Examples.
We have a similar cheat sheet to help you with CSS concepts as well. Check it out here CSS Cheat Sheet
Registered Address:
K 061, Tower K, Gulshan Vivante
Apartment, Sector 137, Noida, Gautam
Buddh Nagar, Uttar Pradesh, 201305
Advertise with us
Company Explore
About Us Job-A-Thon
Legal Offline Classroom Program
Privacy Policy DSA in JAVA/C++
Careers Master System Design
In Media Master CP
Contact Us Videos
Corporate Solution
Campus Training Program
Tutorials DSA
Python Data Structures
Java Algorithms
C++ DSA for Beginners
PHP Basic DSA Problems
GoLang DSA Roadmap
SQL DSA Interview Questions
[Link] 12/13
7/7/25, 6:15 PM HTML Interview Questions and Answers - GeeksforGeeks
Search...
HTML Tutorial HTML Exercises HTML Tags HTML Attributes Global Attributes Event Attributes HTML Interview Questions HTML DOM DOM Audio/Video HTML 5 HTML Examples Color Picker A to Z G
HTML (HyperText Markup Language) is the foundational language for creating web pages and web applications. Whether you're a fresher or an experienced
professional, preparing for an HTML interview requires a solid understanding of both basic and advanced concepts.
Below is a curated list of 50+ HTML interview questions and answers, structured to guide you from fundamental topics to more complex ones, ensuring a
comprehensive preparation.
Table of Content
Basic HTML Interview Questions For Freshers
HTML Intermediate Interview Questions
HTML Interview Questions For Experienced
Note: Before proceeding to learn HTML interview questions and answers, if you are completely new to the language, we recommend building a solid
foundation first by exploring our free HTML Tutorial.
1. What is HTML?
HTML stands for HyperText Markup Language. It is the standard language used to create and design documents on the World Wide Web. HTML structures
web content and allows the inclusion of text, images, links, and other elements.
HTML tags are the building blocks of HTML. They are used to create elements and structure content on a web page. Tags are enclosed in angle brackets, For
example, <p> for a paragraph. Most tags come in pairs: an opening tag <p> and a closing tag </p>.
An HTML document has a defined structure that includes the following elements:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<!-- Content goes here -->
</body>
</html>
Tag: A tag is a part of HTML syntax used to define elements. Tags are enclosed in angle brackets, e.g., <div>.
Element: An element consists of a start tag, content, and an end tag. For example, <p>This is a paragraph.</p> is a paragraph element.
Attributes provide additional information about HTML elements. They are included within the opening tag and usually come in name-value pairs, like
name="value".
For example, in <a href="[Link] href is an attribute specifying the URL of the link.
To create a hyperlink, use the <a> (anchor) tag with the href attribute specifying the URL:
This creates a clickable link labeled "Visit Example" that directs to [Link]
The <img> tag is used to embed images in an HTML document. It is a self-closing tag and requires the src attribute to specify the image source:
[Link] 1/8
7/7/25, 6:15 PM HTML Interview Questions and Answers - GeeksforGeeks
Block-level elements: These elements start on a new line and take up the full width available. Examples include <div>, <p>, and <h1> to <h6>.
Inline elements: These elements do not start on a new line and only take up as much width as necessary. Examples include <span>, <a>, and <img>.
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
The <form> tag is used to create an HTML form for user input. It can contain various form elements like text fields, checkboxes, radio buttons, and submit
buttons.
The <br> tag inserts a line break in the text, moving the content after the tag to a new line. It's an empty tag and doesn't require a closing tag.
To open a link in a new tab, use the target attribute with the value _blank:
The <title> tag defines the title of the HTML document, which appears in the browser's title bar or tab. It's placed within the <head> section.
Comments are not displayed in the browser and are used to leave notes or explanations within the code.
The <meta> tag provides metadata about the HTML document, such as character set, author, description, and keywords. It's placed within the <head>
section.
A table is created using the <table> tag, with rows defined by <tr> and cells by <td>. Headers can be defined using <th>.
<table>
<tr>
<th>Header 1</th>
[Link] 2/8
7/7/25, 6:15 PM HTML Interview Questions and Answers - GeeksforGeeks
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
<head>: Contains meta-information about the document, such as the title, character set, and links to stylesheets and scripts.
<body>: Contains the actual content of the document that is displayed in the browser, such as text, images, and links.
18. How do you specify the character encoding for an HTML document?
The character encoding is specified using a <meta> tag within the <head> section:
<meta charset="UTF-8">
The <strong> tag is used to indicate that the text is of strong importance, typically displayed in bold by browsers.
To create a link that opens the user's default email client with a new message, use the mailto: scheme:
The <em> tag is used to emphasize text, typically displayed in italics by browsers.
A checkbox is created using the <input> tag with the type attribute set to checkbox:
The <label> tag defines a label for an <input> element, improving accessibility and usability. Associating a <label> with an <input> can be done using the for
attribute, which matches the id of the <input>.
A dropdown list is created using the <select> tag, with each option defined by an <option> tag:
The <blockquote> tag is used to define a section that is quoted from another source, typically displayed with indentation by browsers.
Semantic HTML elements clearly describe their meaning in a human- and machine-readable way. Examples include <article>, <section>, <header>, <footer>,
and <nav>. They improve the accessibility and SEO of web pages.
<video controls>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
[Link] 3/8
7/7/25, 6:15 PM HTML Interview Questions and Answers - GeeksforGeeks
controls: Adds video controls like play, pause, and volume.
source: Specifies the video file and its format.
28. What is the purpose of the alt attribute in the <img> tag?
The alt attribute provides alternative text for an image, which is displayed if the image cannot be loaded. It also improves accessibility by describing the
image to screen readers.
The <fieldset> tag is used to group related elements within a form, and the <legend> tag can provide a caption for the group:
<fieldset>
<legend>Personal Information</legend>
<label for="name">Name:</label>
<input type="text" id="name" name="name">
</fieldset>
The <noscript> tag defines alternative content to be displayed if the user's browser does not support JavaScript or if JavaScript is disabled.
<noscript>
<p>JavaScript is not enabled in your browser.</p>
</noscript>
Use the <script> tag with the src attribute to link an external JavaScript file:
<script src="[Link]"></script>
32. What is the difference between the <b> and <strong> tags?
Both tags display text in bold, but <strong> indicates that the text is of strong importance, providing semantic meaning, while <b> does not convey any extra
importance.
The action attribute specifies the URL to which the form data will be submitted when the form is submitted.
Use the <ol> (ordered list) tag, with each list item defined by <li>:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
The <base> tag specifies the base URL for all relative URLs in a document. It must be included inside the <head> section.
<base href="[Link]
Use the <dl> tag for the list, <dt> for each term, and <dd> for each definition:
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
[Link] 4/8
7/7/25, 6:15 PM HTML Interview Questions and Answers - GeeksforGeeks
<dd>Cascading Style Sheets</dd>
</dl>
The enctype attribute specifies how form data should be encoded when submitting it to the server. It's used with the method="post" attribute.
Use <input type="hidden"> to create a hidden input field that stores data without displaying it to the user:
The <address> tag is used to define contact information for the author or owner of a document or article.
<address>
Written by John Doe.<br>
Visit us at:<br>
[Link]<br>
Box 564, Disneyland<br>
USA
</address>
The <canvas> element provides a drawable region in the document that can be used to render graphics, such as charts, games, or other visual images, on the
fly via scripting (usually JavaScript).
42. What is the difference between <b> and <strong>, and between <i> and <em> tags?
The <b> and <i> tags are used for styling text to be bold and italic respectively, without conveying any extra importance or emphasis. In contrast, <strong>
and <em> not only style the text (bold and italic respectively) but also semantically indicate that the text is of greater importance (<strong>) or should be
emphasized (<em>). This semantic meaning can be beneficial for accessibility and SEO.
43. How can you include SVG graphics directly in an HTML document?
Scalable Vector Graphics (SVG) can be embedded directly within HTML using the <svg> tag. This allows for defining vector-based graphics that can scale
without loss of quality.
44. What are data attributes in HTML, and how are they used?
Data attributes in HTML are custom attributes that start with data- and allow you to store extra information on HTML elements. They are often used to
embed custom data that can be accessed via JavaScript.
In JavaScript, you can access these attributes using the dataset property:
The <template> tag is used to declare a fragment of HTML that is not to be rendered immediately when the page loads. Instead, it can be instantiated later
using JavaScript. This is useful for client-side templating.
<template id="my-template">
<div class="card">
<h2></h2>
<p></p>
[Link] 5/8
7/7/25, 6:15 PM HTML Interview Questions and Answers - GeeksforGeeks
</div>
</template>
JavaScript can then be used to clone and insert the template content into the document.
The rel attribute specifies the relationship between the current document and the linked resource. For example, rel="stylesheet" indicates that the linked file
is a CSS stylesheet.
To provide multiple language versions of a webpage, you can use the hreflang attribute in the <link> tag to specify the language of an alternate version. This
helps search engines understand and serve the correct language version to users.
The <output> tag represents the result of a calculation or user action. It's typically used in conjunction with forms to display the outcome of user interactions.
<form oninput="[Link]=parseInt([Link])+parseInt([Link])">
<input type="number" id="a" value="0"> +
<input type="number" id="b" value="0">
= <output name="result" for="a b">0</output>
</form>
49. How can you make an HTML element editable in the browser?
To make an HTML element editable directly in the browser, you can set the contenteditable attribute to true. This allows users to edit the content of the
element in place.
<div contenteditable="true">
This is an editable div. Click here to edit the text.
</div>
The <datalist> tag is used to provide a list of predefined options to an <input> element, typically used to offer autocomplete suggestions.
When the user starts typing in the input field, the browser will display the options defined in the <datalist> that match the current input.
Conclusion
In conclusion, if you are preparing for jobs like a Web Designer that primarily require knowledge of HTML, then you're well-equipped with the interview
questions provided here. These questions cover essential aspects of HTML that will help you perform well in such roles.
However, if you're aiming for positions like a web developer or other more technical profiles that involve a deeper understanding of web technologies, it's a
good idea to also explore additional interview questions on CSS, JavaScript, and other relevant areas. Preparing for a broader range of topics will ensure
you're ready for a wider variety of roles in the tech industry.
[Link] 6/8
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) - Intermediate Level - GeeksforGeeks
Search...
HTML Tutorial HTML Exercises HTML Tags HTML Attributes Global Attributes Event Attributes HTML Interview Questions HTML DOM DOM Audio/Video HTML 5 HTML Examples Color Picker A to Z Guide
In this article, you will learn HTML interview questions and answers intermediate level that are most frequently asked in interviews. Before proceeding to learn
HTML interview questions and answers - intermediate level, first we learn the complete HTML Tutorial, and HTML Interview Questions and Answers - Basic
Level.
Similar Article: HTML Interview Questions and Answers (2024) – Advanced Level
The below contains the list of the top most common & frequently asked HTML & HTML 5 interview questions with their explanations.
Both the tags (<div> and <span>) are used to represent the part of the web page. The <div> tag is used as the block component, and the <span> tag is used as
an inline component.
<div>
A Computer Science Portal for Geeks
<span>
GeeksforGeeks
<span>
</div>
<div> tag: The div tag is known as the Division tag. It is a block-level tag & is used in HTML to make divisions of content on the web page (text, images, header,
footer, navigation bar, etc). Div tag has both openings (<div>) and closing (</div>) tags, and it is mandatory to close the tag.
<span> tag: The HTML span element is a generic inline container for inline elements and content. It is used to group elements for styling purposes (by using the
class or id attributes). A better way to use it is when no other semantic element is available.
The <div> tag is a block level element. The <span> tag is an inline element.
It is best to attach it to a section of a web page. It is best to attach CSS to a small section of a line on a web page.
This tag should be used to wrap a section, for highlighting that section. This tag should be used to wrap any specific word that you want to highlight on your webpage.
id Attribute: The id attribute is a unique identifier that is used to specify the document. It is used by CSS and JavaScript to perform a certain task for a unique
element. In CSS, the id attribute is written using the # symbol followed by id.
Syntax:
<element id="id_name">
In CSS Stylesheet:
#id_name {
// CSS Property
}
class Attribute: The class attribute is used to specify one or more class names for an HTML element. The class attribute can be used on any HTML element. The
class name can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name. The class name can be represented by using
the “.” symbol.
[Link] 1/7
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) - Intermediate Level - GeeksforGeeks
Syntax:
<element class="class_name>
In CSS Stylesheet:
.class {
// CSS Property
}
Difference between id and class attribute: The only difference between them is that “id” is unique on a page and can only apply to at most one element, while
the “class” selector can apply to multiple elements.
When the content of one completely different webpage is embedded into another webpage, it is called a nested webpage. The nested webpage can be created
using the following 2 methods:
<iframe> tag: The iframe in HTML stands for Inline Frame. The “iframe” tag defines a rectangular region within the document in which the browser can
display a separate document, including scrollbars and borders.
<embed> tag: The <embed> tag in HTML is used for embedding external applications which are generally multimedia content like audio or video into an
HTML document.
5. What are the tags that can be used inside the <head> tag?
The <head> element is like a container for metadata i.e. data about data and it also lies between the <html> tag and the <body> tag. Metadata is the data about
the HTML document and is not displayed on the webpage. It defines the document title, style, script, and other meta information.
The metadata means information about data. The <meta> tag in HTML provides information about HTML Document or in simple words, it provides important
information about a document. These tags are basically used to add name/value pairs to describe properties of HTML documents, such as expiry date, author
name, list of keywords, document author, etc. This tag is an empty element because it only has an opening tag and no closing tag, but it carries information
within its attributes. A web document can include one or more meta tags depending on information, but in general, it doesn’t affect the physical appearance of
the document.
Syntax:
<meta attribute-name="value">
Key Points:
The <meta> tag contents are not visible on your browser & is added inside the <head> tag.
They are just used to give additional information about the HTML document.
The <meta> tags are added to our HTML document for the purpose of Search Engine Optimisation.
Page layout is the part of graphic design that deals with the arrangement of visual elements on a page. Page layout is used to make the web pages look better.
It establishes the overall appearance, relative importance, and relationships between the graphic elements to achieve a smooth flow of information and eye
movement for maximum effectiveness or impact.
Header: The part of the front end which is used at the top of the page. <header> tag is used to add header section in web pages.
Navigation bar: The navigation bar is the same as the menu list. It is used to display the content information using hyperlinks.
Index / Sidebar: It holds additional information or advertisements and is not always necessary to be added to the page.
Content Section: The content section is the main part where content is displayed.
Footer: The footer section contains the contact information and other query related to web pages. The footer section is always put on the bottom of the web
pages. The <footer> tag is used to set the footer on web pages.
[Link] 2/7
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) - Intermediate Level - GeeksforGeeks
8. What are semantic elements?
Semantic Elements have meaningful names which tell about the type of content. For instance header, footer, table, … etc. HTML5 introduces many semantic
elements as mentioned below which make the code easier to write and understand for the developer as well as instruct the browser on how to treat them.
article: It contains independent content which doesn't require any other context.
aside: It is used to place content in a sidebar i.e. aside from the existing content.
details: It defines additional details that the user can hide or view.
figure & figcaption: It is used to add an image to a web page with a small description.
footer: It is located at the bottom of any article or document, they can contain contact details, copyright information, etc.
header: It is used for the header of a section introductory of a page.
main: It defines the main content of the document.
mark: It is used to highlight the text.
nav: It is used to define a set of navigation links in the form of a navigation bar or nav menu.
section: A page can be split into sections like Introduction, Contact Information, Details, etc and each of these sections can be in a different section tag.
HTML provides some method to display reserved characters. Reserved characters are those characters that are either reserved for HTML or those which are not
present in the basic keyboard.
For Example: '<' is already reserved in HTML language. Sometimes this character needs to display on the web page which creates ambiguity in the code. Along
with these are the characteristics which are normally not present in basic keyboard ( £, ¥, €, © ), etc. HTML provides some Entity names and Entity numbers to
use these symbols. Entity number is easy to learn.
There are some characters in HTML that are reserved, & have special meaning when they are used in an HTML document. Like if you used less than or greater
than sign in your HTML document then the browser will treat them differently. So we will use HTML entities to insert symbols in a webpage.
©:copyright ©
@: at @
¶: paragraph ¶
§: section §
℅: care of ℅
A Uniform Resource Locator (URL) is simply the address of a website to access the website content like [Link]. But there are certain characters
allowed to use in the URL like alphabets A-Z and a-z, numbers 0-9, and a few special characters. They can be used as it is but the rest of the characters that are
not in this list are used after encoding them to a suitable form.
URL Encoding is the process of converting the URL into a valid format that is accepted by web browsers. URL Encoding takes place by replacing all the
characters that are not allowed with a % sign followed by two hexadecimal digits. These two hexadecimal values represent the numerical values of the
character in the ASCII character set. For example, a space is not acceptable in a URL and is replaced by ‘%20’ or a ‘+’ sign while encoding. Similarly, a $ sign is
replaced by ‘%24’.
Reserved Characters: There are certain characters that sometimes have special meanings in the URL and they can be used in both ways. For example, the ‘/’
character is a reserved character and it has a special meaning when being used as a delimiter to separate the paths of a URL. Here it is used by encoding it to
‘%2F’. Elsewhen it has no special purpose it can be used normally.
12. What is the difference between the POST method and the GET method?
The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers. HTTP works as a request-response protocol
between a client and server. There are 2 HTTP request methods ie., GET & POST
[Link] 3/7
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) - Intermediate Level - GeeksforGeeks
The HTML “canvas” element is used to draw graphics via [Link] “canvas” element is only a container for graphics. One must use JavaScript to actually
draw the graphics. Canvas has several methods for drawing paths, boxes, circles, text, and adding images.
Example: The canvas would be a rectangular area on an HTML page. By default, a canvas has no border and no content. An id attribute has been specified to
refer to it in a script, and a width and height attribute to define the size of the canvas. The style attribute is used to add a border.
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas"
width="400"
height="200"
style="border:2px solid #000000;">
</canvas>
</body>
</html>
Output:
SVG stands for Scalable Vector Graphics. It basically defines vector-based graphics in XML format. SVG graphics do NOT lose any quality if they are zoomed or
resized. Every element and every attribute in SVG files can be animated.
Advantages of SVG: Advantages of using SVG over other image formats (like JPEG and GIF) are:
SVG images can be created and edited with any text editor.
SVG images can be searched, indexed, scripted, and compressed.
SVG images are scalable.
SVG images can be printed with high quality at any resolution.
Multimedia files have formats and different extensions like .wav, .mp3, .mp4, .mpg, .wmv, and .avi
16. How can we allow the browser to tell our location using HTML Geolocation API?
Geo-location in HTML5 is used to share the location with some web site and aware of the exact location. It is mainly used for local businesses, restaurants, or to
show locations on the map. It uses JavaScript to give the latitude and longitude to the backend server. Most of the browsers support Geolocation API. Geo-
location API uses a global navigator object which can be created as follows:
Displaying Location using HTML Geolocation: The following code is displaying the current location with the help of latitude and longitude via HTML
Geolocation.
<!DOCTYPE html>
<html>
<head>
<title>Latitude and longitude</title>
<style>
.gfg {
font-size: 40px;
font-weight: bold;
color: #009900;
margin-left: 50px;
}
.geeks {
margin-left: 150px;
}
p {
font-size: 20px;
margin-left: 20px;
}
</style>
</head>
<body>
<div class="gfg">GeeksforGeeks</div>
<p>Displaying location using Latitude and Longitude</p>
<button class="geeks"
onclick="getlocation()">
Click
</button>
[Link] 4/7
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) - Intermediate Level - GeeksforGeeks
<p id="demo1"></p>
<script>
var variable1 = [Link]("demo1");
function getlocation() {
[Link](showLoc);
}
function showLoc(pos) {
[Link] = "Latitude: "
+ [Link]
+ "<br>Longitude: "
+ [Link];
}
</script>
</body>
</html>
Output:
SessionStorage and LocalStorage are known as the web storage API. Data can be stored on the client-side by using these APIs.
SessionStorage:
HTML Form is a document that stores information of a user on a web server using interactive controls. An HTML form contains different kinds of information
such as username, password, contact number, email id, etc.
The elements used in an HTML form are check box, input box, radio buttons, submit buttons, etc. Using these elements the information of a user is submitted on
a web server. The form tag is used to create an HTML form.
Example:
<!DOCTYPE html>
<html>
<body>
<form>
Username:
<br>
<input type="text"
name="username">
<br>
Email id:
<input type="text"
name="email_id">
<br>
<input type="submit"
value="Submit">
</form>
</body>
</html>
Output:
[Link] 5/7
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) – Advanced Level - GeeksforGeeks
Search...
HTML Tutorial HTML Exercises HTML Tags HTML Attributes Global Attributes Event Attributes HTML Interview Questions HTML DOM DOM Audio/Video HTML 5 HTML Examples Color Picker A to Z G
In this advanced HTML Interview Questions, we cover the most frequently asked interview questions of HTML. Here, you'll find detailed questions related
to advanced HTML topics and in-depth explanations to help you succeed.
If you're just starting out or are at an intermediate level, we have dedicated pages for Beginner and Intermediate HTML Interview Questions and
Answers.
HTML Interview Questions and Answers (2024) Beginner Level
HTML Interview Questions and Answers (2024) Intermediate Level
The <a> tag (anchor tag) in HTML is used to create a hyperlink on the webpage. This hyperlink is used to link the webpage to other web pages. It’s either
used to provide an absolute reference or a relative reference as its “href” value. Click Here to know more in detail.
Syntax:
Example:
<!DOCTYPE html>
<html>
<body>
<h1>
Welcome to
<a href="[Link]
GeeksforGeeks
</a>
</h1>
<h2>This is anchor Tag</h2>
</body>
</html>
Output:
The elements that only have start tags and do not contain any content within it, these elements are called Void Elements. It can only have attributes but
does not contain any kind of content.
Example of such elements are <br>, <hr>, <img>, <input>, <link>, <base>, <meta>, <param>, <area>, <embed>, <col>, <track>, <source> etc.
We can accomplish this task by using the display propertyhaving its value as “block”, to change the element from inline to block-level element.
The Container tags are generally divided into three parts, i.e., the opening tag, content(which will display on the browser), and closing tag. In the content
part, they can also contain some other tags. These opening and closing tags are used in pairs. For instance, <html>….</html>, <head>…</head>, <title>…
</title>, <body>….</body>, etc.
Syntax:
<tag_name> …</tag_name>
The Empty Tags that do not contain any closing tags are known as empty tags. Empty tags contain only the opening tag but they perform some action in the
webpage. For eg: <br>, <link>, <img>, <hr>, <meta>, <source> etc.
Syntax:
<tag_name>
Please refer to the Is container tag same as the empty tag in HTML? If not, why? article for further detail.
[Link] 1/6
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) – Advanced Level - GeeksforGeeks
5. What tags are used to separate a section of text?
<br> tag: Usually <br> tag is used to separate the line of text. It breaks the current line and conveys the flow to the next line.
<p> tag: The <p> tag contains the text in the form of a new paragraph.
<blockquote> tag: It is used to define a large quoted section.
6. In how many ways you can apply CSS to your HTML file?
There are 3 ways in which we can add CSS to our HTML file, they are given below:Please refer to the Types of CSS (Cascading Style Sheet) article for more
details.
Inline CSS: Inline CSS contains the CSS property in the body section attached with the element known as inline CSS. This kind of style is specified within
an HTML tag using the style attribute.
Internal or Embedded CSS: This can be used when a single HTML document must be styled uniquely. The CSS ruleset should be within the HTML file in
the head section i.e the CSS is embedded within the HTML file.
External CSS: External CSS contains a separate CSS file that contains only style property with the help of tag attributes (For example class, id, heading, …
etc). CSS property is written in a separate file with a .css extension and should be linked to the HTML document using the link tag. This means that for
each element, style can be set only once and that will be applied across web pages.
It is possible to include one CSS file in another and it can be done multiple times. Also, import multiple CSS files in the main HTML file or in the main CSS file.
It can be done by using the @import keyword. Click here to know more in detail.
Scripts can be placed inside the body, the head section of an HTML page, inside both head and body, or can be added externally. Please refer to the Where to
put JavaScript in an HTML Document? article for more detail.
JavaScript in head: A JavaScript function is placed inside the head section of an HTML page and the function is invoked when a button is clicked.
JavaScript in the body: A JavaScript function is placed inside the body section of an HTML page and the function is invoked when a button is clicked.
External JavaScript: JavaScript can also be used as external files. JavaScript files have file extension .js . To use an external script put the name of the
script file in the src attribute of a script tag. External scripts cannot contain script tags.
Physical and Logical tags are used in HTML for better visibility and understanding of the text by the user on the web page. However, both tags differ from
each other as suggested by their names.
a) Logical Tag: This tag is used in HTML to display the text according to the logical styles. Following are the Logical tags commonly used in HTML.
<abbr>: It defines an abbreviation that is used to define the abbreviation or short form of an element.
<acronym>: It is used to define an acronym.
<address>: It defines an address element.
<cite>: It defines citation ie., used to define the title of a work.
<code>: It defines computer code text.
<blockquote>: It defines a long quotation.
<del>: It stands for delete and is used to mark a portion of text which has been deleted from the document.
<dfn>: It represents a definition element and is used to represent a defining instance in HTML.
<ins>: It is used to specify a block of inserted text.
<kbd>: It defines keyboard text.
<pre>: It defines preformatted text.
<q>: It defines a short quotation.
<samp>: It defines sample computer code.
<strong>: It defines strong text.
<var>: It defines a variable ie., used to specify the variable in a mathematical equation or in a computer program.
b) Physical Tag: This tag is used in HTML to provide actual physical formatting to the text. Following are the Physical tags commonly used in HTML. Please
refer to the Physical and Logical Tags in HTML article for further details.
The MathML comes in HTML5 the current MathML version is 3 it was introduced in the year 2015. The MathML stands for Mathematics Markup Language. It
is used to represent the mathematical equation or expression in web browsers like other HTML elements. The 1st version of MathML was released in the
year of 1998 and after that, the 2nd version was released.
[Link] 2/6
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) – Advanced Level - GeeksforGeeks
Basically, MathML is a complex mathematical formula or equation visual representation made easy. The MathML is supported in the HTML5, all the MathML
tag must be used inside the <math> and </math> [Link] MathML is used to describe mathematics as a basis for the machine to machine communication, it
is intended to be handled by specialized authoring tools such as equation editors and it is meaningful to other applications also.
11. What is the difference between <html lang=”en’> and <html lang=”en-US’>?
The lang attribute specifies which language is used to write the content of a web page. It is used to set the language for the whole text of the web [Link]
difference between <html lang=”en’> and <html lang=”en-US’> is described below:<html lang=”en’>: The <html lang=”en’> only specifies the language
code of the page meaning en or English is used for all the text on the page.<html lang=”en-US’>: The <html lang=”en-US’> specifies the language code of
the page followed by the country code which means the US style of English language is used for all the text on the page.
Please refer to the What is the difference between <html lang=”en’> and <html lang=”en-US’>? article for a detailed description.
This task can be achieved through <marquee> tag in HTML that helps to create scrolling text or image on a webpage. It scrolls either from horizontally left to
right or right to left, or vertically from top to bottom or bottom to top.
Syntax: The marquee element comes in pairs. It means that the tag has an opening and closing elements.
<marquee>
<--- contents --->
</marquee>
A manifest file is a text file that tells the browser to cache certain files or webpages so that they can be used even in offline mode. HTML5 cache webpages
by specifying manifest attribute in <html> tag. All the web pages that contain manifest attributes or are specified in the manifest file will be cached whenever
a user visits that page. Manifest files are saved with the .appcache extension. It always starts with the CACHE MANIFEST keyword and contains three
sections:
CACHE: This section lists all the resources including webpages, CSS stylesheets, JavaScript files, and images that will be cached immediately after their
first download.
NETWORK: This section lists all the resources that will never be cached. These resources can’t be used in offline mode and always require a connection to
the server.
FALLBACK: This section lists the fallback resources that will be used in case a page is not accessible. It specifies the primary resource that will be
replaced with the fallback resource specified next to it in case of server connection failure.
There are several different ways to open a hyperlink in another window or tab such as using JavaScript, jQuery, or HTML. In order to open a hyperlink in
another window or tab, use the target attribute and provide it value _blank in the anchor tab. Click Here to know more in detail.
Syntax:
<element target="_blank|_self|_parent|_top|framename"\>
Attribute Values:
Web workers are multithreaded object which is used to execute Javascripts in the background without affecting the performance of the application or
webpage. Web Workers allow for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions and allow long
tasks to be executed without affecting the responsiveness of the web page. Generally, it is used for big CPU-intensive tasks.
Multipart Form Data: The ENCTYPE attribute of the <form> tag specifies the method of encoding for the form data. It is one of the two ways of encoding the
HTML form. It is specifically used when file uploading is required in HTML form. It sends the form data to the server in multiple parts because of the large
size of the file.
Syntax:
[Link] 3/6
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) – Advanced Level - GeeksforGeeks
</form>
SVG is a type of image format which is written in XML for vector-based graphics. Every element and every attribute in SVG files can be animated. There are
several ways to use SVG images in HTML, which are described below: Please refer to the How to add Scalable Vector Graphics to your web page? article for
a more detailed description.
SVG in a <img> tag: This is the basic & simple way to insert the SVG image to a webpage. For this method, we can simply use the <img> tag and then
specify the file path or image link in the src attribute. To use this method, we should have downloaded the SVG image file or SVG image link.
SVG in a <object> tag: The <object> tag can be used to insert the SVG images by specifying the URL of the resource that will be used by the object using
the data attribute.
SVG in a <embed> tag: The <embed> tag can be used to insert the SVG image by specifying the link in the src attribute. This tag is now deprecated and
removed support for browser plug-ins in most of the modern browsers.
SVG in a <image> tag: The <image> SVG element includes images inside SVG documents. It can display raster image files or other SVG files.
HTML5 introduced 5 most popular media element tags that are supported by the browsers, which are described below: Please refer to the What are the
media element tags introduced by HTML5? article for a more detailed description.
<audio>: It is an inline element that is used to embed sound files into a web page.
<video>: It is used to embed video files into a web page.
<source>: It is used to attach multimedia files like audio, video, and pictures.
<embed>: It is used for embedding external applications which are generally multimedia content like audio or video into an HTML document.
<track>: It specifies text tracks for media components audio and video.
An Event is an action or occurrence recognized by the software. It can be triggered by the user or the system. Mostly Events are used on buttons, hyperlinks,
hovers, page loading, etc. All this stuff gets into action(processed) with the help of event handlers.
<element onclick="myScript">
<element onblur="myScript">
onchange:This event occurs when the value of an element has been changed.
<element onchange="myScript">
<element onfocus="myScript">
Event:
<element onclick="myScript">
<element onmouseover="myScript">
Please refer to the How to Handle JavaScript Events in HTML? article for a more detailed description.
onmouseover:This event occurs when the user hovers the mouse pointer over an element.
20. What is the difference between Cellpadding and Cellspacing in HTML Table?
Cellpadding: Cellpadding specifies the space between the border of a table cell and its contents (i.e) it defines the whitespace between the cell edge and the
content of the cell.
Syntax:
Cellspacing: Cellspacing specifies the space between cells (i.e) it defines the whitespace between the edges of the adjacent cells.
Syntax:
[Link] 4/6
7/7/25, 6:13 PM HTML Interview Questions and Answers (2024) – Advanced Level - GeeksforGeeks
Difference between cell padding and cell spacing:
Cellpadding Cellspacing
It specifies the space between the border of a table cell and its contents. It specifies the space between adjacent cells.
It is created by using HTML <table> tag but the type attribute is set to cell It is also created by using HTML <table> tag but the type attribute is set to cell
padding. spacing.
It is mainly meant for a single cell. Cellspacing can get subjected to more than one cell.
The default cell padding value is 1 Whereas, the default cell spacing value is 2
Cellpadding is widely used and considered to be an effective mean Cellspacing is less effective than Cellpadding.
Please refer to the Difference between Cellpadding and Cellspacing article in detail.
Registered Address:
K 061, Tower K, Gulshan Vivante
Apartment, Sector 137, Noida, Gautam
Buddh Nagar, Uttar Pradesh, 201305
Advertise with us
Company Explore
About Us Job-A-Thon
Legal Offline Classroom Program
Privacy Policy DSA in JAVA/C++
Careers Master System Design
In Media Master CP
Contact Us Videos
Corporate Solution
Campus Training Program
Tutorials DSA
Python Data Structures
Java Algorithms
C++ DSA for Beginners
PHP Basic DSA Problems
GoLang DSA Roadmap
SQL DSA Interview Questions
R Language Competitive Programming
Android
[Link] 5/6