[2022] HTML Interview Questions – Frequently Asked

Written by

Vaaruni Agarwal


HTML or Hypertext Markup Language is the language that the World Wide Web understands. It is not a programming language, but a markup language, i.e. HTML uses tags to define the elements of a document. HTML is the standard markup language for all the web pages (web-based documents). Let us take a look at 50+ HTML Interview Questions

1) What is HTML?


HTML or Hypertext Markup Language is the language that the World Wide Web understands. It is not a programming language, but a markup language, i.e. HTML uses tags to define the elements of a document. HTML is the standard markup language for all the web pages (web-based documents).

2) What are tags?

Tags are the fundamental elements of HTML as it is a markup language. The composition of the tags is that the content is placed in angular brackets. There may be either paired on unpaired HTML eggs.

3) Do all HTML tags come in a pair?

The <img> tag and <br> tags are examples on unpaired HTML tags, thus all HTML tags are not paired.

4) What types of lists are available in HTML?

The following types of lists are possible:

– ordered list

– un-ordered list

– definition list

– menu list

– directory list

5) How can you comment in HTML?

Comments in HTML begins with “<!–“and ends with “–>”. The comments are used to enter the data that must not be converted into HTML text and may be used to understand the code in a better way.

 For example:

<!—Comments in HTML –>

6) Which semantic tags are included in HTML5 version?

There are two semantic tags, included in HTML 5, these are the <article> and <section> tags.

7) What is an image map?

Image map as the name suggests is a map in the form of an image in HTML. Using an image map one can easily create links via an image in a web page.

8) Can we indent HTML code with white spaces?


White spaces are a blank sequence of space characters. It is treated as a single space character in HTML. The browser collapses multiple spaces into a single space, so the text lines can be indented easily. This enables the HTML
code to be organized into a much more readable format.

9) Which browsers support HTML5?

The latest versions of Google Chrome, Apple Safari, Mozilla Firefox, and Opera are some of the browsers that support HTML5 and its features.

10) How do you insert a copyright symbol on a browser page?

To insert the copyright symbol, type &copy; or & #169; in an HTML file.

11) How can links be created within the same page?


Links can be created using the <a> tag, called as the anchor tag in HTML. It must include the reference to that section of page, where the user intends to go. Most commonly used to navigate to top at the end of the document.

12) How to keep the list elements straight?

The list elements can be kept straight by using the indents.

13) What is a link?


A Link is actually a piece of text which when clicked on follows the web page address associated with it. Links are used to traverse through multiple web pages either on the same website or even through multiple websites.

        

14) What is the use of alternative text in an image?


Alternative text which is specified by the alt attribute of an image tag, specifies the text that must be shown to the user whoever is loading the web page in case the image is not showing. This alt text must be similar to what an
image was trying to show. For Eg: Wherever a logo is to be shown, then the alt text can be written as logo.

15) Do older version of HTML files work on newer browsers?

Yes, older HTML files are compliant to the HTML standard. Mostly the files of older versions of HTML work on the newer browsers, though some features may not work.

16) Does a hyperlink apply to text only?

No, hyperlinks can work in the images as well. The images on which hyperlinks are applied are known as image maps.

 

17) How to represent a symbol, if it is not supported in an OS?

In such a case where the operating system does not supports a particular character, it is displayed in the form of an image.

18) How can list sequence change?

The <li> tag includes two attributes – type and value. Using the value attribute the list sequence can change.

19) What are style sheets?


Style sheets enables the developers to build consistent, transportable, and well-defined templates of the website. Using the style sheets advanced images, fonts, colors and other appearance related manipulations can be made. This
makes a simple web page look attractive. The Cascading Style Sheets or CSS is commonly used for the purpose.

20) What bullet types available in HTML?


Bullet types are used to refer to the different list elements in an unordered list. There are different types of bullets available in an unordered list and can be set by the type attribute. It can be set to disc, square, or circle.

21) How can a multicolored text be created in a webpage?

Multicolored text can be created with the help of the color attribute of the font tag in HTML. Using this tag, even a single line of text can contain multiple colored words.

22) What are character entity values?


A character entity reference refers to the content of a named entity. It is a value that includes the numerical values and characters. Thus a character entity value is a combination of characters and numerical values.

23) What is <figure>?

The figure tag represents a piece of self-contained flow content. This is mostly used as a single unit as a reference the main flow of the document.

24) What is the advantage of grouping several checkboxes together?

Grouping checkboxes together helps to organize them in a better way. Checkbox buttons can have their name and do not need to belong to a group. A single web page can have many different groups of checkboxes.

25) What will happen if tags are overlapped?

If case of overlapping, only the first tag will be recognized. This may cause unexpected or undesirable results.

26) What is an applet?

An applet is a small program. It is embedded within the web pages to perform a specific functionality, such as computation, animation, information processing, etc.

27) What happens when tags are left empty?

In such a case, when the paired tags are left empty, then nothing happens. This only works with paired tags and if unpaired tags are used, then it will be executed in a similar way as it is expected from a tag.

28) How to set color for table borders?

The table borders can be colored using the Style Sheets, however if the style sheet is not used then the borders will have the same color as that of the table text.

29) What is href?


href, is an attribute of the anchor tag. The anchor tag when used specifies the presence of a hyperlink in the text. The address of that link is specified by the href attribute of the anchor tag. Since anchor tag is a paired tag, so
the text written between the opening and closing tags is what acts as a hyperlink.

30) How many types of headings are there in HTML?


The HTML contains six types of headings. These are defined with the <h1> to <h6> tags. Each type of heading tag displays different text size from another. So, <h1> is the largest heading tag and <h6> is the
smallest one.

31) What are the different states of a link in HTML?

The link usually has three states:

  • Unvisited link – underlined and blue, link not opened yet
  •  Visited link – underlined and purple, link already opened
  • Active link – underlined and red, link currently opened

32) Which HTML tags are associated with table creation?

There are different HTML tags associated with the creation of a table in HTML. All these tags along with their functions are listed in the below table:

Tag

Description

<table>

Used to define a table.

<tr>

Used to define a row in a table.

<th>

Used to define a header cell in a table.

<td>

Used to define a cell in a table.

<caption>

Used to define the table caption.

<colgroup>

Used to specify a group of column for formatting.

<col>

used to specify column properties for each column.

<tbody>

used to group the body content.

<thead>

used to group the header content.

<tfooter>

used to group the footer content.

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

HTML elements communicate to the browser to render text. When these elements are enclosed by the angular brackets <>, then they are known as the HTML tags.

34) What is semantic HTML?


Semantic HTML is a coding style, in this the HTML markup is used to reinforce the semantics. For example: In semantic HTML, instead of <b> and <i> tag the <strong> and <em> tags are used for bolds and italics
respectively.

35) How to create a nested webpage in HTML?

A nested webpage, that is a webpage within a webpage can be created with the help of the <iframe> tag For example:

<!DOCTYPE html>    

<html>    

<body>    

<h2>Nested Webpage</h2>    

<p>Use the height and width attributes to specify the size of the iframe:</p>    

<iframe src=”https://www.studymite.com/” height=”300″ width=”400″></iframe>    

</body>    

</html>    

36) Explain the layout of a Webpage.

The layout of a webpage is specified by the different html tags, these are as follows:

  • <header>: defines a header
  • <nav>: defines a container for navigation links
  • <section>: defines a section in a document
  • <article>: defines an independent article
  • <aside>: defines a sidebar
  • <footer>: defines a footer

37) What is a marquee?

A marquee is a form that allows the presence of a scrolling text in a web page. <marquee> are used for this purpose, whichever text is to be scrolled is placed inside these paired marquee tags.

38) How can you send an email using text in HTML?


An email can be sent easily using the anchor tag’s href attribute. Firstly, the text must be changed to a hyperlink. Then to make sure that the mail is sent, the mailto command is used within the href tag. The format is as follows:

<a href=”mailto:emailaddress”>text </a>

39) What are empty elements?

HTML elements that contain no content in them are called empty elements. Some examples of empty elements are: <br>, <hr>,etc.

40) What is a span tag?

A span tag is used for following purposes in a Web page:

  • For adding color on text
  • For adding background on text
  • For Highlighting any color text

41) Is a <!DOCTYPE html> tag is a HTML tag?

No, the <!DOCTYPE html> declaration is not an HTML tag. The main purpose of the <!DOCTYPE html> tag  is that it is used to instruct the web browser about the HTML page.

42) Why is URL encoded in HTML?


In order to convert the non-ASCII characters into a format that can be used over the Internet the URL is encoded. This is done so because a URL is sent over the Internet by using the ASCII character-set only. The non-ASCII
characters are replaced with a “%” followed by the corresponding hexadecimal digits to avoid an overhead of conversion.

43) What is SVG?


SVG describes the two-dimensional vector and vector/raster graphics. SVG images and their behaviors are defined in XML text files. It is mostly used for diagrams like pie charts, 2-Dimensional graphs in an X, Y coordinate system.

44) Which type of video formats are supported by HTML5?

HTML 5 supports three types of video format, these are:

  • mp4
  • WebM
  • Ogg

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

The progress tag is used to represent the progress of the task. On the other hand, a meter tag is used to measure data within a given range.

46) What is the use of figcaption tag in HTML 5?

The <figcaption> element is used to provide image caption. It is an optional tag and is used with <figure> element.

47) What is button tag?

The button tag is used in HTML 5 to create a clickable button in the HTML form. It can be used to create different types of buttons very easily.

48) What is the use of details tag?

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

49) What is datalist tag?


The datalist tag provides an autocomplete feature on the form element. It facilitates users to choose the predefined options to the users to select the data from a given list rather than typing the whole data again.

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

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

[2022] HTML Interview Questions &#8211; Frequently Asked