HTML Questions

Warm up for HTML questions with most asked questions and answers for junior, mid, and senior roles.

Mid

What is the use of an iframe tag?

Show Answer
The iframe tag is used to embed another document within the current HTML document.
Mid

What are the entities in HTML?

Show Answer

An HTML entity is a piece of text ("string") that begins with an ampersand (&) and ends with a semicolon (;).

Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces).

You can also use them in place of other characters that are difficult to type with a standard keyboard.

Mid

What is the canvas element in HTML5?

Show Answer

The canvas element is used to draw graphics, images, and other visual elements on the web page.

Mid

Do all HTML tags have an end tag?

Show Answer

No, in HTML5 there are 14 tags without ending tag for example:


Mid

Which type of video formats are supported by HTML5?

Show Answer

HTML5 supports the following video formats:

  • mp4
  • WebM
  • Ogg
Mid

What are the limits of the text field size?

Show Answer

The default size for a text field is around 13 characters. However, if you include the size attribute, you can set the size value to be as low as 1. The maximum size value will be determined by the browser width.

Mid

What is the relationship between the border and rule attributes?

Show Answer

The border attribute is used to set the width of the border.

 

The rule attribute is used to set the style of the border.

Mid

What is Cell Spacing and Cell Padding?

Show Answer

Cell spacing is used to set the space between cells.

 

Cell padding is used to set the space between the cell content and the cell border.

Mid

How many types of CSS can be included in HTML?

Show Answer

There are two types of CSS: inline and external.

Mid

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

Show Answer

There are 3 types of lists in HTML:

Mid

What is the difference between HTML elements and tags?

Show Answer

HTML elements are the actual pieces of content that are displayed on the web page.

Tags are used to create HTML elements.

Mid

Difference between link tag <link> and anchor tag <a>?

Show Answer

The link tag is used to link to an external file.

The anchor tag is used to link to a page within the same HTML document.

Mid

In how many ways can we position an HTML element?

Show Answer

There are four ways to position an HTML element.

1. Absolute Positioning

2. Relative Positioning

3. Fixed Positioning

4. Static Positioning

Mid

In HTML, does a hyperlink only apply to text?

Show Answer

No, a hyperlink applies to both text and images.

Mid

Explain the layout of HTML?

Show Answer

The layout of an HTML file is the way the content is displayed on the web page, it is a blueprint used to arrange web pages in a well-defined manner.

Mid

When are comments used in HTML?

Show Answer

Comments are used to add extra information to HTML elements.

You can use it using the tag.

Mid

What is a style sheet?

Show Answer

A style sheet is a file that contains CSS or other form of styling code.

Mid

What is a marquee?

Show Answer

An HTML marquee is a scrolling piece of text displayed either horizontally across or vertically down your webpage depending on the settings.

Mid

What is the difference between div and span in HTML?

Show Answer
The div tag is used to divide the web page contents into blocks The span tag is used to stylise text. It applies styling to a section of the inline content
Mid

Why is a URL encoded in HTML?

Show Answer

URL is encoded into a format that can be transmitted over the Internet.

Mid

What are empty elements?

Show Answer

Empty elements are elements that have no content.

For example:



Mid

What is the use of a span tag?

Show Answer
The tag is used as a generic container of inline elements.

 

It is used for styling purpose to the grouped inline elements (using class and id attribute or inline style).
Mid

What is SVG?

Show Answer

SVG is a language for describing scalable vector graphics.