10 Most Important HTML Interview Questions & Answers

1.What is <!Doctype html> in HTML5?

Doctype stands for Document Type Declaration. It informs the web browser about the type and version of HTML used in building the web document. This helps the browser to handle and load it properly.

2. What is difference between div and span in HTML?

<div><span>
The <div> tag is a block level element.The <span> tag is an inline element.
It is best to attach it to a section of a web page.It is best to attach a CSS to a small section of a line in a web page.
It accepts align attribute.It does not accept align attribute.
This tag should be used to wrap a section, for highlighting that section.This tag should be used to wrap any specific word that you want to highlight in your webpage.

3. What is semantic tags and non semantic tags in HTML?

Semantic Elements
These elements simply mean, elements with meaning. The reason being, there definition in the code tells the browser and the developer what they are supposed to do. Framing in simpler words, these elements describe the type of content they are supposed to contain.

Following is the list of some semantic elements :

  • article
  • aside
  • details
  • figcaption
  • figure
  • footer
  • form
  • header
  • main
  • mark
  • nav
  • table
  • section

Non-Semantic elements
Unlike, semantic elements they don’t have any meaning. They don’t tell anything about the content they contain. They can be used with different attributes to mark up semantics common to a group.

Following is the list of some non-semantic elements:

  • div
  • span

4. What is difference between html and html5?

BasisHTMLHTML5
Mobile friendlinessHTML is less mobile friendlyHTML5 is more mobile friendly
Drag and Drop featureIt does not support drag and drop effects.It supports drag and drop effect
Media supportDoes not support audio and video without use of flash playerSupport Audio and Video with use of <audio> and <video> tag .
Javascript supportDoes not support javascript to run in browserSupport javascript to run in background with the help of JS – web worker API
Vector GraphicsHTML uses vector graphics with the help of various technologies such as VML, Flash, etc.Vector graphics is an important part of HTML5 as we use SVG and canvas in it.
Storage optionFor storage browser cache can be used as temporary storageFor storage Application cache, web SQL database, and web storage can be used in HTML5
Error HandlingHTML can not handle inaccurate syntax and any other error . Here inaccurate syntax means that the written syntax (order of tags ) is different from the original syntax . Example of basic syntax : <html> <head> <title> </title> </head> <body> </body> </html>HTML5 can handle inaccurate syntax and other errors.
2-D shapes drawingShapes like circle, rectangle, triangle, etc. are not possible to draw in HTMLShapes like circle, rectangle, triangle, etc. are easy to draw in HTML5 .’
Efficiency, speedAs it’s older version, it is not fast, efficient, and flexible with respect to HTML5.HTML5 is efficient , faster and flexible in comparison to HTML .
Browser supportMost old browsers support HTMLNew browsers support HTML5 such as Firefox, chrome etc.

5. What is Iframe tag in Html5?

An inline frame (iframe) is a HTML element that loads another HTML page within the document. It essentially puts another webpage within the parent page. They are commonly used for advertisements, embedded videos, web analytics and interactive content.

6. What are the formatting tags in html?

HTML Formatting is a process of formatting text for better look and feel. HTML provides us ability to format text without using CSS. There are many formatting tags in HTML. These tags are used to make text bold, italicized, or underlined. There are almost 14 options available that how text appears in HTML and XHTML.

In HTML the formatting tags are divided into two categories:

  • Physical tag: These tags are used to provide the visual appearance to the text.
  • Logical tag: These tags are used to add some logical or semantic value to the text.

7. What is difference <b> and <Strong> tag in html?

HTML <strong> Tag
The <strong> tag in HTML is the parsed tag and used to show the importance of the text. Make that text bold.

Syntax: 

<strong> Contents... </strong>

HTML <b> Tag
The bold tag or <b> is also one of the formatting elements of HTML. The text written under <b> tag makes the text bold presentationally to draw attention.

Syntax:

<b> Contents... </b>

The main difference between these two tag is that the strong tag semantically emphasizes on the important word or section of words while the bold tag is just offset text conventionally styled in bold. Below is the code to show this difference.

8. What is view port attribute in html?

The viewport is the user’s visible area of a web page. The viewport varies with the device, and will be smaller on a mobile phone than on a computer screen. Before tablets and mobile phones, web pages were designed only for computer screens, and it was common for web pages to have a static design and a fixed size.

9. What is attribute in html?

An HTML attribute is a piece of markup language used to adjust the behavior or display of an HTML element. For example, attributes can be used to change the color, size, or functionality of HTML elements.

10. What is block level element and inline element in html?

In general, HTML elements can be divided into two categories : block level and inline elements.

Block Level Elements:

  • HTML block level elements can appear in the body of an HTML page.
  • It can contain another block level as well as inline elements.
  • By default, block-level elements begin on new lines.
  • block level elements create larger structures (than inline elements).

List of block level elements

  • p
  • h1, h2, h3, h4, h5, h6
  • ol, ul
  • pre
  • address
  • blockquote
  • dl
  • div
  • fieldset
  • form
  • hr
  • noscript
  • table

HTML Inline elements

  • HTML inline level elements can appear in the body of an HTML page.
  • It can contain data and other inline elements.
  • By default, inline elements do not begin on new lines.
  • inline elements create shorter structures (than block level elements).

List of inline elements

  • b, big, i, small, tt
  • abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var
  • a, bdo, br, img, map, object, q, script, span, sub, sup
  • button, input, label, select, textarea

Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock