Top 10 HTML Interview Questions

Top 10 HTML Interview Question

These Top 10 HTML Interview Question will surely help you to boost your preparation.

Que 10: What is the difference between HTML and XHTML?
Ans 10: XHTML is based on XML thus required to be well formed and has to follow some rules like :

  • <!DOCTYPE html> is mandatory.
  • <html>,<head>,<title>, and <body> tags are mandatory.
  • Elements must always be closed.
  • Attribute names must be in lower case. etc.
  • But in HTML, these rules are not necessary.

Que 9: What is the use of <del>(delete) tag?
Ans 9: <del> tag is used to show a deleted word or sentence in html.
example: <p>This is a <del>deleted</del> word.</p>

Want to watch video instead? You can also save it to watch later.

Que 8: How to declare default language of the text in a web page in HTML?
Ans 8: It can be declared in <html> tag by using “lang” attribute and also can be used with any html tag.
example: <html lang=”en”> (in HTML 4.01)
<html lang=”en” xml:lang=”en” xmlns=””> (in HTML 5/ XHTML)

Que 7: What are the Semantic elements in HTML?
Ans 7: Semantic elements clearly describes its meaning to the browser and the developer.
example: <form>,<header>,<nav>,<aside> etc.
example of non-semantic: <div>,<span>.

Que 6: What is the difference between Id and Class attribute in HTML?
Ans 6: Value of class attribute can be same in multiple elements but value of Id can be used for only one element.
<p class=”same”></p>
<span class=”same”></span>
<h3 class=”same”></h3>
<p id=”unique”></p>
<span id=”another-unique-id”>

Que 5: How to insert quotation(” “) marks in HTML?
Ans 5: <q> tag is used to insert quotation marks in html.
example: <p>Apple: <q> Apple is a Fruit. </q></p>

Que 4: What are the empty tags?
Ans 4: HTML tags with no content are called empty tags. <hr> and <br> are an empty element without a closing tag. Empty elements can be closed in the opening tag.
example: <br />,<hr /> etc.

Que 3: Name some HTML tags which has been deprecated in HTML 5?
Ans 3: <marquee>,<big>,<center>,<frames> and more elements from HTML4 are no longer supported in HTML5 at all and they have been removed completely.

Que 2: How to draw graphics in HTML?
Ans 2: <canvas> tag is used to draw graphics on a web page.
example: <canvas id=”myCanvas” width=”200″ height=”100″></canvas>

Que 1: How to add favicon in HTML page?
Ans 1: Favicon is a small icon of the website which appears in the tab of a browser. By using <link> tag we can add a favicon to a webpage.
example: <link rel=”icon” href=”img/favicon.png” type=”image/png”/>

Boost your preparation by reading these Top 10 CSS 3 Interview Questions

Your Response

This site uses Akismet to reduce spam. Learn how your comment data is processed.