×

Top 50 HTML Interview Questions for 2024

1) What is HTML?

HTML stands for Hyper Text Markup Language. It is used for creating web pages and web applications. HTML documents are made up of two things: the content and the tags.

2) What are the features of HTML5?

The features of HTML are:
  • HTML is simple to use and easy to understood
  • HTML is Platform independent (works on any platform) language
  • It is a markup language
  • It has a lot of formatting tags
  • Make Web pages more attractive

3) Who is the father of HTML?

Tim Berners-Lee is known as the father of HTML.

4) Do all HTML tags come in pair?

NO, for example: <img> tag and <br> tag.

5) What is difference between HTML and XHTML?

The differences between HTML and XHTML are:
HTML XHTML
HTML stands for Hyper Text Markup Language. XHTML stands for Extensible Hyper Text Markup Language.
HTML is used to create Static Web Pages. XHTML is used to create Dynamic Web Pages.
HTML is about displaying the information. XHTML is about describing the information.
HTML DOCTYPE is not mandatory. XHTML DOCTYPE is mandatory.

6) How to create a button which acts like a link?

There are two ways to create button which acts like a hyperlink are:
<form action=https://www.javatoint.com >

<input type="submit" value="Text On Button">

</form>

7) What are the new attributes provided in HTML5 for <form>?

The attributes provided in HTML5 are:
  1. nonvalidate.
  2. autocomplete.

8) What are the new attributes provided in HTML5 for <input>?

Following are the new attributes provided in HTML5 for <input>:
Autofocus Form Formaction
Formmethod Formenctype Formnovalidate
Formtarget Height and Width List
Min and Max Multiple Pattern
Placeholder Required Step

9) How do you insert a comment in html?

Comment Syntax in HTML5 is :<!-- TYPE COMMENT HERE --! > For example:
<!--  JAVATPOINT  --!>
OR
<!-  My NAME IS XYZ --! >

10) Write a HTML table tag sequence that output the following:

101 rupees 100 bugs 500 dollar 108 rupees 500 bugs 900 dollar
<table>

<tr> <td>101 rupees</td> <td>100 bugs</td> <td>500 dollar</td>

</tr>

<tr> <td>109 rupees</td> <td>500 bugs</td> <td>900 dollar</td>

</tr>

</table>

11) Which browsers support HTML 5?

Almost all browsers support HTML5:
  • Chrome.
  • Firefox.
  • Opera.
  • Internet Explorer.
  • Safari.

12) What is datalist in HTML 5?

Datalist elements provide you the autocomplete feature. Below is the Html code for datalist:
<html>

<head><title>DATALIST</title></head>

<body>

<h1>Datalist</h1>

<input list="Country">

<datalist id="Country">

<option value="India">

<option value="Argentina">

<option value="Belgium">

<option value="Angola">

<option value="Armenia">

</datalist>

</body>

</html>

13) What are the New Media Elements in HTML5?

New Media Elements are:
  1. <audio> : For audio content.
  2. <video> : For video content.
  3. <source>: For media resources.
  4. <embed> : For embedded content.
  5. <track> : For text track content.

14) What are the new APIs provided by the HTML 5 Standard?

The HTML 5 standard comes with a number of new APIs. A few of them are as follows:
Media API Text Track API
Application Cache API User Interaction
Data Transfer API Command API
Constraint Validation API History API

15) What are the extension supported by HTML?

HTML supports both .htm and .html extension.

16) Name three ways to define a color in html?

There are three ways to define a color in html:
  1. By using named values.
  2. By using Hexadecimal values.
  3. By using RGB colors.
Example:-
<!DOCTYPE html>

<html>

<head>

<title>COLOR</title>

   <style>

    h1{background-color:lightblue;}

    h2{background-color:#404040 }

    h3{background-color:rgb(204,204,0)}

   </style>

</head>

<body>

<h1>javaTpoint(By NAMED VALUES)</h1>

<h2>javaTpoint(By HEXADECIMAL VALUES)<h2>

<h3>javaTpoint(By RGB COLORS)<h3>

</body>

</html>

17) HTML5 <input> Types ?

Following are the input types in HTML5:
search time color
email date datetime
datetime-local tel range
url week number

18) How to add audio and video in HTML5?

AUDIO AND VIDEO controls with autoplay feature:
<!DOCTYPE html>

<html>

<head>

<title>HEARBEAT</title></head>

<body>

<h1>FOR AUDIO</h1>

<audio controls autoplay loop>

<source src="HEARBEAT.mp3" type="audio/mp3"/>

</audio>

<h1>FOR VIDDEO</h1>

<video controls autoplay loop>

<source src="TP.mp4" type="video/mp4"/>

</video>

</body>

</html>

19) What does a <hgroup> tag do?

The <hgroup> tag is used to group heading elements. The <hgroup> element is used to group a set of <h1> to <h6> elements. Example
<hgroup>

<h1>JAVATPOINT</h1>

<h2>SSS IT PVT LTD</h2>

</hgroup>

20) What are the common lists available in HTML?

The common lists available in HTML are:
  • Menu list
  • Ordered list
  • Unordered list
  • Directory list
  • Definition list

21) What is Image Map?

Image Map: By using a single image, you can link too many different Web pages.

22) How will you align a table to the Right, Left and Center?

To align a table to the Right: use <table align="right"> To align a table to the Left: use <table align="left"> To align a table to the Center: use <table align="center">

23) How can I hide my page source?

No, you cannot hide page source because it is required by browser to display the content.

24) Can you create a multi colored text on a web page?

Yes, you can create a multi colored text on a web page. For example:
<font color ="color">Tutorial and Example</font>

25) What are empty elements?

The HTML elements with no content are known as empty elements. For example: <br> tag and <hr> tag etc

26) What is span tag?

span tag is used to:
  • Add color on text
  • Highlight any text
  • Add background on text
Example:
<!DOCTYPE html>

<html>

<head>

<title>Uses of SPAN</title>

</head>

<body>

<p><b> Tutorial <span style="color:blue;"> and </span> Example</b></p>

<p><b>Tutorial <span style=" background-color:red"> and </span> Example</b></p>

</body>

</html>

27) Which tag is used to separate section of texts in HTML?

Usually <br> tag is used. Some other tags:
  • <p> tag
  • <blockquote> tag
These tags are also used to separate section of texts.

28) How to add an image as background image of a web page?

Example:
<!DOCTYPE html>

<html>

<head>

<title>Background Image</title>

</head>

<body background ="image.jpeg">

<h1>Background Image</h1>

</body>

</html>

29) What are the ways to include the CSS with HTML?

The ways to include the CSS with HTML are:
  • Inline CSS
  • Internal Style Sheet
  • External Style Sheet

30) What is <dl> tag?

<dl> tag defines the description list. The <dl> tag is used with <dt> and <dd> tags. Here <dt> tag defines the data term and <dd> tag defines the data definition.

31) What is Cell Padding?

Cell Padding: It is the space or gap between the cell content and cell border.

32) What is Cell Spacing?

Cell Spacing: It is the gap or space between two cells of same tables.

33) Does HTML support JavaScript?

Yes.

34) In which sections you can add JavaScript in HTML?

There are four sections in which you can add JavaScript in HTML are:
  • In Head Section
  • In Body Section
  • In any External File
  • Head and Body both

35) What is Marquee in HTML?

Marquee is a tag in HTML that is used to scroll an image or text in the web page either horizontally or vertically. Example:
<!DOCTYPE html>

<html>

<head>

<title>Example of Marquee</title>

</head>

<body>

<marquee>Tutorial and Example</marquee>

</body>

</html>

36) What are the attributes of marquee available in HTML?

The attributes of marquee are:
  • behavior
  • direction
  • width
  • height
  • hspace
  • vspace
  • scrolldelay
  • scrollamount
  • loop
  • bgcolor

37) What is canvas in HTML?

Canvas is a tag in HTML that is used to draw graphics on web page. The canvas element allows us to build 2D shapes and bitmap images. Here, you must need a scripting language to use canvas in HTML.

38) How to create a basic empty HTML canvas?

Example of basic empty canvas:
<!DOCTYPE html>

<html>

<head>

<title>Example of Marquee</title>

</head>

<body>

<canvas id="myCanvas" width="400" height="200" style="border:3px solid;">

Browser does not support the HTML5 canvas tag.

</canvas>

</body>

</html>

39) How to create a progress bar in HTML?

Example of progress bar with value and max attributes:
<!DOCTYPE html>

<html>

<body>

Downloading content:

<progress value="50" max="100"></progress>

</body>

</html>

40) What are the types of Frames tags used in HTML?

The types of Frames tags used in HTML are:
  • <frame>?</frame>
  • <iframe>...</iframe>
  • <frameset>...</frameset>
  • <noframes>...</noframes>

41) How would you automatically transfer your visitors to a new web page?

You can automatically transfer your visitors to a new page by using meta tag. Example:
<!DOCTYPE html>
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=https://www.tutorialandexample.com/">
</head>
<body>
<h1>Old Page</h1>
</body>
</html>

42) Can a single hyperlink points to two different web pages?

NO.

43) What are the types of video formats supported by HTML5?

There are three types of video formats supported by HTML5 are:
  • mp4
  • ogg
  • webM

44) How to use copyright symbol on a browser page?

There are two ways to use the copyright symbol on a browser are:
  • By using © in an HTML file
  • By using © in an HTML file
Example:
<!DOCTYPE html>

<html>

<body>

<p>© Copyright</p>

<p>© Copyright</p>

</body>

</html>

45) What is SVG?

SVG stands for Scalable Vector Graphics. This modularized language is used to describe graphics in XML. SVG (Scalable Vector Graphics) is mostly used for vector diagrams like:
  • pie charts
  • 2D graphs etc

46) How to draw a circle using SVG tag in HTML?

Example:
<!DOCTYPE html>

<html>

<body>

<svg width="100" height="100">

<circle cx="50" cy="50" r="40" stroke="yellow" stroke-width="4" fill="black" />

</svg>

</body>

</html>

47) What is figure tag in HTML?

<figure> tag is used to add an image on the web page with caption. <figure> tag is the new tag introduced in HTML5.

48) Are HTML tags case sensitive?

NO, HTML tags are not case sensitive.

49) What is the use of getCurrentPosition() method of geolocation object in HTML5?

getCurrentPosition() method: This method is used to retrieves the current geographic location of the user.

50) What is use of watchPosition() method of geolocation object in HTML5?

watchPosition() method: It is used to retrieves periodic updates about the current geographic location of the device.

Related Topics

Top 30 Perl interview questions for 2024

1) What is Perl? It is a programming language which is used for web development, system administration, GUI development and etc. It is also known as cross-platform programming language. 2) What are the...

4 minutes read.

Top 40 TensorFlow Interview Questions and Answers

Commonly Asked TensorFlow Interview Questions for Fresher Q1. What is TensorFlow? TensorFlow is the machine learning library developed by Google's brain team, it supports multiple abstraction levels, and we can choose the...

13 minutes read.

Top 50 ReactJS Interview Questions for 2024

Top 50 Frequently asked ReactJS Interview Questions Q-1. What is React? Ans-1 React is a front-end JavaScript library which is developed by Facebook in 2011. It follows the component-based approach and allows us to...

15 minutes read.

SSIS Interview Questions and Answers

Q.1 What is SSIS? SQL Server Integration Service (SSIS) is a component of Microsoft SQL Server. It is a powerful ETL tool that is used for building enterprise-level data transformation and...

5 minutes read.

Artificial Neural Network Interview Questions

1. Explain Neural Network?  Neural Network is a sequence of an algorithm that gives its best to recognize the underlying relationship in a data-set through a process. The artificial neural network...

8 minutes read.

Top 30 Zend Framework Interview Questions for 2024

1) What is Zend Framework? Zend is an open source, object-oriented web application framework. It is implemented in PHP 5. It was developed in 3 March 2006. 2) What is the use...

6 minutes read.

Top 30 Web Service Interview Questions for 2024

1) What is a Web Service? Web service is a client server application or component. It is used for communication. It is way to communicate between two devices over network. In another word...

5 minutes read.

Top 31 Koa Interview Questions for 2024

1) What is Koa? Koa is a very small framework which provides us a minimal interface to build our applications. It is quite flexible and there are numerous modules available on...

4 minutes read.

Top 15 ExpressJS Interview Questions for 2024

1) What is ExpressJs? Express Js is a framework for node.js which is light-weight and fast. It is used to develop web and mobile applications. 2) What are the features of ExpressJs? Following...

4 minutes read.

Top 14 Elixir Interview Questions for 2024

1) What is Elixir? Elixir is a dynamic, functional language. It is designed to build scalable and maintainable applications. 2) Who developed Elixir? Ericsson developed elixir in 1986. 3) What is the stable version of...

2 minutes read.

Top 15 iOS (iPhone, iPad) Interview Questions for 2024

Top 20 Most Frequently asked iOS Interview Questions and Answers 1) What is iOS? iOS is a mobile operating system developed by Apple Inc. iOS offers iPhone and iPad application development using...

3 minutes read.

Top 30 FuelPHP Framework Interview Questions for 2024

1) What is FuelPHPFramework? FuelPHP Framework is an open source web application and written in PHP scripting language. It is based on the HMVC (Hierarchical Model View Controller) design pattern. It was released...

6 minutes read.

Top 15 Java Multithreading Interview Questions for 2024

1) What is Multithreading in Java ? It is a process of executing multiple threads simultaneously. It is used to achieve multitasking. It is mostly used in animation and games etc. 2) What are...

4 minutes read.

Top 43 React Native Interview Questions for 2024

1. What is React Native? React native is an open-source JavaScript framework designed by Facebook for native mobile applications development. It is based on a JavaScript library-React. React Native saves your development...

11 minutes read.

Top 28 Scala Interview Questions for 2024

1) What is Scala? Scala is a functional and object-oriented programming language. It is used to develop web application, mobile application, enterprise application, desktop based application etc. Everything in Scala is in object...

4 minutes read.

Top 18 Blockchain Interview Questions and Answers for 2024

Top 20 Commonly Asked Blockchain Interview Questions and Answers 1. What do you understand by Blockchain? Blockchain is a chain of blocks made up of digital pieces of information or can be defined as...

6 minutes read.

Top 30 Core Java Interview Questions for 2024

1. What is the difference between HashMap and Hashtable in Java? Ans. S.No. HashMap Hashtable 1. ...

6 minutes read.

Top 22 DOJO Interview Questions for 2024

1) What is DOJO? DOJO is an open source JavaScript framework designed for very fast development of JavaScript/AJAX based application and websites having cross platform interdependencies. 2) Enlist all features of DOJO. ...

4 minutes read.

Top 24 Clojure Interview Questions for 2024

1) What is Clojure? Clojure is a dynamic, general-purpose programming language. It is simple, coherent and powerful tool. It is based on Lisp Programming language. 2) Which platform is used to run...

4 minutes read.

Top 15 SVG Interview Questions for 2024

1) What is SVG? SVG stands for Scalable Vector Graphics, It is XML based format used to draw dimentional vector images. It is a W3C standard. SVG supports all image formats. 2) What are...

2 minutes read.