All HTML interview questions

All HTML interview questions

  1. What is HTML?

Html is short for Hypertext Markup Language, and is the language of the World Wide Web. It’s the standard text formatting language used for creating and displaying pages on the web.

  1. What are tags?

Content is placed in between HTML tags in order to properly format it. HTML tags are composed of three things: opening tag, content and ending tag. Some tags are unclosed tags

Ex: <html> Content here</html>, <br/>

  1. What is the difference between HTML elements and tags?

Html elements are used to render text in the browser. Tags are those which is inside <> bracket.

  1. What are the lists in HTML?
  • Order list
  • Unordered list
  • Menu list
  • Directory list
  • Definition list
  1. How do you insert a comment in HTML?

<! — Your comment is here –>

  1. How to insert symbol in HTML file?

We can insert symbols by inserting the number or entity of the symbol. Example: for inserting Copy right symbol we need to write &copy; or &#169;

  1. What are bullet types available in HTML?

The type attribute for unordered lists can be set to disc, square, circle or any symbol.

  1. What is applet?

Applets are small programs that can be embedded within web pages to perform some specific functionality, such as computations, animations, and information processing. Applets are written using the Java language.

  1. With HTML starting and ending tag is the body part render?

Yes! Without the <html></html> the body render.

  1. How do you create a link that will connect to another web page when clicked?

By anchor tag <a href=”target address”>your link name</a>

Example: <a href=>Google</a>

  1. Can a single text link point to two different web pages?

No. The <a> tag can accept only a single href attribute, and it can point to only a single web page.

  1. What is a marquee?

A marquee allows you to put a scrolling text in a web page. To do this, place whatever text you want to appear scrolling within the <marquee> and </marquee> tags.

  1. How do you create a text on a webpage that will allow you to send an email when clicked?

<a href=mailto:your mail address>mail me</a>

  1. How are active links different from normal links?

The default color for normal and active links is blue. Some browsers recognise an active link when the mouse cursor is placed over that link; others recognise active links when the link has the focus. Those that don’t have a mouse cursor over that link is considered a normal link.

  1. What are empty elements?

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

  1. What is Canvas in HTML5?

The HTML canvas element provides HTML a bit mapped surface to work with. It is used to draw graphics on the web page. The HTML 5 <canvas> tag is used to draw graphics using scripting language like JavaScript.

  1. What is the new form element in HTML5?

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

  • Color
  • Date
  • Datetime-local
  • Email
  • Time
  • Url
  • Range
  • Telephone
  • Number
  • Search
  1. Which Video format support in HTML?

HTML 5 supports three types of video format:

  • mp4
  • webm
  • ogg
  1. What is the difference between progress and meter tag?

HTML <progress> tag is used to display the progress of a task. It provides an easy way for web developers to create progress bar on the website. It is mostly used to show the progress of a file uploading on the web page.

The <meter> tag defines a scalar measurement within a known range, or a fractional value. This is also known as a gauge. Examples: Disk usage, the relevance of a query result, etc.

  1. What is the use of <figure> tag in HTML5?

It’s used to add photo in the document.

  1. If I don’t put <! DOCTYPE HTML> will HTML5 work?

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

  1. What is the user of required attribute in HTML5?

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

  1. Why we use alt text?

If the browse not loading the element or not support the element it display the alt text.

  1. How many heading tags in HTML?

There are six heading tags in HTML they are <h1> to <h6>

  1. What is HTML attributes?

It provides additional information about the elements.

  1. What is lang attribute in <html>?

Declaring a language is important for accessibility applications (screen readers) and search engines.

  1. What is the difference between title tag and attribute?

<Title> tag display the text on the top of the browser tab and the title attribute will be displayed as a tool tip when you mouse over the element.

  1. What is the user of <pre>?

The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.

  1. What are the HTML formatting elements?
  • <b> – Bold text
  • <strong> – Important text
  • <i> – Italic text
  • <em> – Emphasised text
  • <mark> – Marked text
  • <small> – Small text
  • <del> – Deleted text
  • <ins> – Inserted text
  • <sub> – Subscript text
  • <sup> – Superscript text
  1. What is the use of <iframe>?

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

  1. What is the user of <Meta>?

The <meta> element is used to specify page description, keywords, author, and other metadata. Metadata is used by browsers (how to display content), by search engines (keywords), and other web services.

  1. How to add JavaScript into HTML element?

Write the JavaScript code inside the <Script>.

  1. How to add styles into HTML element?

Write the style code inside the <style>.

  1. What is the difference between div and span tags in html?

The difference between span and div is that a span element is in-line and usually used for a small chunk of HTML inside a line (such as inside a paragraph) where as a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.

  1. What id DOM?

The Document Object Model (DOM) is a programming API for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

  1. What is event in HTML?

HTML 4 added the ability to let events trigger actions in a browser, like starting a JavaScript when a user clicks on an element.

37. What are the new HTML elements in HTML5?

Tag Description
<article> Defines an article in the document
<aside> Defines content aside from the page content
<bdi> Defines a part of text that might be formatted in a different direction from other text
<details> Defines additional details that the user can view or hide
<dialog> Defines a dialog box or window
<figcaption> Defines a caption for a <figure> element
<figure> Defines self-contained content, like illustrations, diagrams, photos, code listings, etc.
<footer> Defines a footer for the document or a section
<header> Defines a header for the document or a section
<main> Defines the main content of a document
<mark> Defines marked or highlighted text
<menuitem> Defines a command/menu item that the user can invoke from a popup menu
<meter> Defines a scalar measurement within a known range (a gauge)
<nav> Defines navigation links in the document
<progress> Defines the progress of a task
<rp> Defines what to show in browsers that do not support ruby annotations
<rt> Defines an explanation/pronunciation of characters (for East Asian typography)
<ruby> Defines a ruby annotation (for East Asian typography)
<section> Defines a section in the document
<summary> Defines a visible heading for a <details> element
<time> Defines a date/time
<wbr> Defines a possible line-break