HTML Interview Questions and Answers

Q1. What is HTML?

Ans. HTML stands for Hyper Text Markup Language. HTML is used to create internet web pages. It is generally a collection of certain keywords called ‘tags’ that are helpful in writing the document to be displayed using a browser on the internet.

Q2. What is! DOCTYPE?

Ans. The declaration must be the very first thing in your HTML document, before the tag. The declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in. In HTML 4.01, the declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language so that the browsers render the content correctly. HTML5 is not based on SGML and therefore does not require a reference to a DTD.

Tip: Always add the declaration to your HTML documents, so that the browser knows what type of document to expect.

Note: The tag does not have an end tag.

Tip: The declaration is NOT case sensitive.

Q3. What is difference between HTML and XHTML?

Ans. Introduction HTML

  1. HyperText Markup Language is the main markup language for developing web pages and other information that can be displayed in a web browser.
  2. Filename extension

.html, .htm

  1. Internet media type


  1. Application

Application of Standard Generalized Markup Language (SGML).

  1. Function

Web pages are written in HTML.

  1. Origin

Proposed by Tim Berners-Lee in 1987.

  1. Versions


Introduction XHTML

  1. XHTML (Extensible HyperText Markup Language) is a family of XML markup languages that mirror or extend versions of the widely used Hypertext Markup Language (HTML), the language in which web pages are written.
  2. File Extension

.xhtml, .xht, .xml, .html, .htm

  1. Internet Media type


  1. Function

Application of XML 2000.

Origin: World Wide Web Consortium Recommendation in 2000.

Extended version of HTML that is stricter and XML-based

  1. Version


Q3. What is a responsive website?

Ans. There are many features of Responsive websites As:

  1. Responsive design is an approach to web page creation that makes use of flexible layouts, flexible images, and cascading style sheet media queries.
  2. A responsive website changes its appearance and layout based on the size of the screen the website is displayed on.
  3. Responsive sites can be designed to make the text on the page larger and easier to read on smaller screens.
  4. They can also be configured to make the buttons on the phone’s screen easier to press.
  5. It more sophisticated ways of using responsive design on a mobile device include: formatting the website to hide or present entirely different information, radically changing the graphics and colors, or even reducing the site to emphasize just its most important piece.

Q4. What is the Difference between html4 & html5?

Ans. HTML-4

  1. HTML4 uses common structures like headers, footers.
  2. It cannot embed video and audio directly and makes use of flash player for it.
  3. These cannot handle inaccurate syntax.
  4. It has traditional API’s which does not include canvas and content editable API’s
  5. It local storage is not possible and tags that can handle only one dimension are present.
  6. HTML 4.01 (1999)
  7. HTML 4.01, the tag was used to describe an item in a definition list.

There are three different declarations in HTML 4.01.


  1. HTML5 uses new structures such as drag, drop and much more
  2. It can contain embedded video and audio using flash player.
  3. It is capable of handling inaccurate syntax.
  4. It introduced many new API’s which facilitate
  5. These new tags and new features like local storage are enhanced.
  6. HTML 5 (2012).
  7. Its tag is used to describe a term/name in a description list.
  8. HTML5 there is only one.

Q5. What is a metro template or metro theme?

Ans. Metro is the codename of a typography-based design language by Microsoft. A key design principle is better to focus on the content of applications, relying more on typography and less on graphics. Early examples of Metro principles can be found in Encarta 95 and MSN 2.0. The design language evolved in Windows Media Center and Zune and was formally introduced as “Metro” during the unveiling of Windows Phone 7. Under the name Microsoft design language, it has since been incorporated into several of the company’s other products, including the Xbox 360 system software, Xbox One, Windows 8, Windows Phone, and

Q6. Write the attributes used to transfer one page to another and from one window to another.

Ans. A simple element with one attribute and you will be able to link to anything and everything.

The element a stands for “anchor”.& the attribute href is short for “hypertext reference”, which specifies where the link leads to type an address on the internet or a file name.

Q7. How many color names are supported by a web browser?

Ans. There are three Color methods in HTML RGB – RED, GREEN, BLUE: uses 3 pairs of numbers (generally not used) HEX – Written in Hexadecimal numbers like AF1818 (Frequently used in web designing) ColorName – There are only 16 color names so not used. The 17 standard colors are aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.

Q8. What is alternate text (alt)? Why is it used?

Ans. Alt attribute specifies an alternate text for an image, if the image cannot be displayed.

Q9. What Types of websites?

Ans. There are two types of websites

1) Static

2) Dynamic.

Q10. How to start or stop marquee text when it is moving?

Ans. Using tag Eg. <OnMouseOver=”this.stop()” onMouseOut=”this.start()>

Eg.< marquee behavior=”alternate” direction=”right” onmouseover=”this.stop()” onmouseout=”this.start()”>  hello</marquee>

Q11. How many rows and columns can be made in one table?

Ans. According to need otherwise infinite (∞)

Q12. What is difference between Cellspacing and Cellpadding?

Ans. Cell spacing

  1. Cell spacing attribute is not supported in HTML5.
  2. Cell spacing attribute specifies the space, in pixels, between cells.
  3. C. <table cell spacing=”pixels”>
  4. <!DOCTYPE html>






border:1px solid black;





Cell padding

  1. Cell padding attribute is not supported in HTML5. Use CSS instead.
  2. Cell padding attribute specifies the space, in pixels, between the cell wall and the cell content.

C.< table cell padding=”pixels”>

  1. <! DOCTYPE html>






border:1px solid black;





Q13. What Types of Comments and why it is used?

Ans. <—This is a comment. Comments are not displayed in the browser–->

<p> This is a paragraph </p>

Q14. Name the attribute which is used to control the speed of the text in marquee tag. Whether we use both attributes at the same time?

Ans. Different between Scroll amount and scroll delay in below lines:

  1. Scroll amount
  2. The scroll amount attribute is used to control the speed at which the text contained inside the marquee moves across in whichever direction has been specified.
  3. Value

An integer value (higher value provides a faster speed). The default scroll amount value is “6”.

  1. Scroll delay
  2. The scroll delay is used to slow the speed at which the text inside the marquee moves across the viewport. It has the opposite use of the scroll amount attribute which is used to speed up the movement.
  3. Value

An integer which represents the delay in milliseconds (1/1000th of a second), thus scroll delay=”200″ equates to a 5th of a second. The default value is “85”

Q15. Should the height and width of the table mentioned? Why?

Ans. No, we don’t want to mention table height and width, it automatically adjusted according to text.

Q16. What is DD Tag?

Ans. A tag is used to describing a term/name in a description list. The tag is used in conjunction with (defines a description list) and (defines terms/names).

As: Tag you can put paragraphs, line breaks, images, links, lists, etc.

Q17. What is Different between row span and col span?

Ans. Table cells can span across more than one column or row. The attributes COLSPAN (“how many across”) and ROWSPAN (“how many down”) indicate how many columns or rows a cell should take up.

Q18. How to Work forms?

Ans. Procedure:

  1. Form Create using HTML
  2. Form design using CSS
  3. Form Validation using server/client side.

Server Side: PHP, JSP, ASP

Client Side: JavaScript, JQuery

Q19. How to display code on the webpage?

Ans. We use ampersent sign(·&) to show the special characters such as etc.

For less than· < and for greater then>

Q20. What is the Difference between Get Method and Post Method?

Ans. GET

  1. GET method is designed for getting information(a document, a chart, or a database query)
  2. It can be bookmarked.
  3. The parameter can send but the parameter.
  4. Data is limited to what we can stuff into the request line (URL). Safest to use less than 2K of parameters, some servers handle up to 64K.
  5. Large variable values 7607 character maximum size.
  6. Visibility

GET method is visible to everyone (it will be displayed in the browser’s address bar) and has limits on the amount of information to send

  1. Restrictions on form data length

Yes, since form data is in the URL and URL length is restricted. A safe URL length limit is often 2048 characters but varies by browser and web server.

  1. Usability

GET method should not be used when sending passwords or other sensitive information.

  1. Security

GET is less secure compared to POST because data sent as part of the URL. So it’s saved in browser history and server logs in plaintext

  1. Security

GET is less secure compared to POST because data sent as part of the URL. So it’s saved in browser history and server logs in plaintext

  1. History

Parameters remain in browser history because they are part of the URL


  • POST method is designed for posting information. A credit card number
    • Some new chart data
    • Information that is to be stored
    • In a database.
  • It cannot be bookmarked.
  • Parameter can send parameters, including.
  • Uploading files, to the server.
  • Large variable values 8 Mb max size for the POST method.
  • POST method variables are not displayed in the URL.
  • No restrictions
  • POST method used when sending passwords or other sensitive information.
  • POST is a little safer than GET because the parameters are not stored in browser history or in web server logs.
  • More difficult to hack
  • Parameters are not saved in browser history.

 Q21. Why we use encrypt tag?

Ans. Encrypt attribute specifies how the form-data should be encoded when submitting it to the server. The encrypt attribute can be used only if method=”post”.

Q22. What is frame? How many types of frame?

Ans. HTML Frames can be used to split a web page so you can load multiple HTML files or pages into one web page.

This will cause the web browser to display multiple pages at one time.

A common example of this technique which I like to use is to display an index of a document on the left side of the browser window with descriptions and links so when the reader clicks on the link, that page is displayed on the right side of the browser window.

Using HTML frames may be a bit complicated at first for those new to HTML, so you may want to skip this section or skim it, then come back to it when you want to create frames in your HTML documents.

Q23. What is a difference between iframe and frameset?


Ans. The frame is a HTML tag that is used for dividing the web page into various frames/windows. Used as a tag, it specifies each frame within a frameset tag.

Tag frameset


Placement of frames

Comparatively complicated

Width of frames/panes

Difficult to adjust

Difference between iFrame

iframe as is also a tag used in HTML but it specifies an inline frame, that means it is used to embed some other document within the current HTML document.

Tag frameset

Not required

Placement of frames


Width of frames/panes

Easy to adjust

Q24. What is Full name of iframe?

Ans. iframe stands for inline frames


<iframe name=”inlineframe” src=”float.html” frameborder=”0″ scrolling=”auto” width=”500″ height=”180″ marginwidth=”5″ marginhei ght=”5″></iframe>

Q25. How to validate HML code?

Ans.  A validator is a software program that can check your web pages against the web standards. When using a validator to check HTML, XHTML or CSS documents, the validator returns a list of errors found, according to your chosen standard. Make sure you make it a habit to validate all your web pages before publishing.

Q26.  HTML is a language for describing web pages.

Ans. HTML stands for Hyper Text Markup Language

  1. HTML is a markup language
  2. A markup language is a set of markup tags
  3. The tags describe document content
  4. HTML documents contain HTML tags and plain text
  5. HTML documents are also called web pages
  6. The current version is 5.0
  7. HTML5 and CSS3 is currently used for designing

Q27. Define W3C?

Ans. It stands for world wide web consortium, It is an organization whose work is to prove a web application valid or invalid. SEO Ranking is used to rank a web application at number.

Q28. How to open any new link in a new tab or window?

Ans. Using tag we can open new tab.

Eg. <a href=”” title=”Gmail” target=”_blank>

Q29. What is FEVICON? why used?

Ans. Fevicon is a small icon called favorite icon or shortcut icon, according to W3C format it must be in <HED>16X16 px with .ico extension name, it doen’t support .jpg or .gif extensions. it is used in tag. it is showed in address bar.

<” link rel=”shortcut icon” href=”image01.ico””>


Q30. What is form action?

Ans. Action attribute specifies where to send the form-data when a form is submitted. Or Form action is the action whenever we click on Submit button it validates it from other pages, or when, we click submit, your browser sends the form data to the other page indicated in Action for validation.


News Reporter
IT Software and web development, Core PHP, JavaScript, JQuery, HTML, CSS, CakePHP, Angularjs, Codeigniter etc.

Leave a Reply

Your email address will not be published. Required fields are marked *