Javatpoint Logo

91-9990449935

 0120-4256464

Javatpoint Logo

HTML Interview Questions

A list of top frequently asked HTML interview questions and answers are given below.


1) What is HTML?

HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a standard text formatting language which is used to create and display pages on the Web. More details...


2) What are Tags?

HTML tags are composed of three things: opening tag, content and ending tag. Some tags are unclosed tags.

HTML documents are made of two things:

  • content, and
  • tags

Content is placed between tags to display data on the web page. More details...


3) Do all HTML tags have end tag?

No. There are some HTML tags that don't need a closing tag. For example: <image> tag, <br> tag. More details...


4) What are some common lists that are used when designing a page?

There are many common lists which are used to design a page. You can choose any or a combination of the following list types:

  • Ordered list
  • Unordered list
  • Menu list
  • Directory list
  • Definition list
More details...

5) What is the difference between HTML elements and tags?

HTML elements communicate to the browser to render text. When the elements are surrounded by brackets <>, they form HTML tags. Most of the time, tags come in pair and surround content.


6) What is semantic HTML?

Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic HTML <b> </b> tag is not used for bold statement as well as <i> </i> tag is used for italic. Instead of these we use <strong></strong> and <em></em> tags.


7) What is image map?

Image map facilitates you link many different web pages using a single image. You can define shapes in images that you want to make part of an image mapping.


8) How to insert a copyright symbol on a browser page?

can insert a copyright symbol by using &copy; or &#169; in an HTML file.


9) How do you keep list elements straight in an HTML file?

You can keep the list elements straight by using indents.


10) Does a hyperlink only apply to text?

No, you can use hyperlinks on text and images both. More details...


11) What is a style sheet?

A style sheet is used to build a consistent, transportable, and well designed style template. You can add these templates on several different web pages.


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

Yes. To create a multicolor text on a web page you can use <font color ="color"> </font> for the specific texts you want to color.


13) Is it possible to change the color of the bullet?

The color of the bullet is always the color of the first text of the list. So, if you want to change the color of the bullet, you must change the color of the text.


14) What is a marquee?

Marquee is used to put the scrolling text on a web page. You should put the text which you want to scroll within the <marquee>......</marquee> tag. More details...


15) How many tags can be used to separate section of texts?

There are three tags used to separate the texts. i.e. usually <br> tag is used to separate line of texts. Other tags are<p> tag and <blockquote> tag.


16) How to make a picture a background image of a web page?

To make a picture a background image on a web page, you should put the following tag code after the </head> tag.

Here, replace the "image.gif" with the name of your image file which you want to display on your web page.


17) What are empty elements?

HTML elements with no content are called empty elements. For example: <br>, <hr> etc.


18) What is the use of span tag? Give one example.

The span tag is used for following things:

  • For adding color on text
  • For adding background on text
  • Highlight any color text etc.

Example:


19) What is the use of iframe tag?

An iframe is used to display a web page within a web page.

Syntax:

Example:

Target to a link:


HTML5 Interview Questions

Let's see a list of top HTML5 interview questions and answers.


20) What is canvas in HTML5?

Canvas is an HTML area which is used to draw graphics. More details...


21) What is SVG?

HTML SVG is used to describe the two dimensional vector and vector/raster graphics. More details...


22) What are the different new form element types in HTML 5?

Following is a list of 10 important new elements in HTML 5:

  • Color
  • Date
  • Datetime-local
  • Email
  • Time
  • Url
  • Range
  • Telephone
  • Number
  • Search

23) Is there any need to change the web browsers to support HTML5?

No. Almost all browsers (updated versions) support HTML 5. For example: Chrome, Firefox, Opera, Safari, IE etc.


24) Which video formats are supported by HTML5?

HTML 5 supports three types of video format:

  • mp4
  • webm
  • ogg
More details...

25) Is audio tag supported in HTML 5?

Yes. It is used to add sound or music files on the web page. More details...


26) What is the difference between progress and meter tag?

The progress tag is used to represent the progress of the task only while the meter tag is used to measure data within a given range. More details...


27) What is the use of figure tag in HTML 5?

The figure tag is used to add a photo in the document on the web page. More details...


28) What is button tag?

The button tag is used in HTML 5. It is used to create a clickable button within HTML form on the web page. It is generally used to create a "submit" or "reset" button. More details...


29) What does details and summary tag?

The details tag is used to specify some additional details on the web page. It can be viewed or hidden on demand. The summary tag is used with details tag. More details...


30) What is datalist tag?

The HTML 5 datalist tag provides an auto complete feature on form element. It facilitates users to choose the predefined options. More details...


31) How tags are migrated from HTML4 to HTML5?

No.Typical HTML4Typical HTML5
1)<div id="header"><header>
2)<div id="menu"><nav>
3)<div id="content"><section>
4)<div id="post"><article>
5)<div id="footer"><footer>

Header and Footer Example

HTML 4 Header and Footer:

HTML 5 Header and Footer:

Menu Example

HTML 4 Menu:

HTML 5 Menu:


32) If I do not put <!DOCTYPE html> will HTML 5 work?

No, browser will not be able to identify that it is a HTML document and HTML 5 tags will not function properly.


33) What is the use of required attribute in HTML5?

It forces user to fill text on textfield or textarea before submitting form. It is used for form validation.

Example:


34) What are the new <input> types for form validation in HTML5?

The new input types for form validation are email, url, number, tel and date.

Example: