All HTML Interview Questions & Answers

The complete set of HTML Interview Questions & Answers. These FAQs focus on mostly HTML but also on CSS, JavaScript & jQuery. HTML FAQs available for freshers as well as experienced.

What is the full form of HTML?

HTML stands for Hyper Text Markup Language. It is used to create and format Web documents.


How to add Comments in HTML?

Comment tags <!-- and --> are used to insert comments in HTML.


How do you create links to sections within the same page?

Internal links make it easy for your users to jump to different parts of your page.
Destination Anchors: <a name="top"></a> Source Anchors: <a href="#top">Top </a>


Do all HTML tags require both a begin and end tag?

No, some tags do not come in pair.

For an example: <img> tag and <br> tag do not require end tags.


How to Add the Copyright Symbol to Web Page?

To insert the copyright symbol, use &copy; or &#169; in an HTML file.


What is HTML?

HTML stands for Hypertext Markup Language. It is widely used markup language to create web pages over the internet. HTML tags are used to structure & display content on websites.


What is the difference between HTML Tags & Elements?

HTML Tags are the labels or entity that create web pages. Each tag provides special meaning for the content.

For example: <p> is paragraph tag.

HTML element is a combination of start tag, content and an end tag. Mostly, website content is written inside start tag ( <p>) and an end tag ( </p>).

For example: <p>This is sample content</p> represents HTML element.


What is the HTML page structure? Explain with example

A basic HTML page structure mainly consists of 3 HTML tags, <html>, <head>, <body> and <!DOCTYPE html> declaration.

A standard HTML page contains <!DOCTYPE html> in the begining. Then <html> tag starts. HTML Page title, style and javascript is included inside the <head> tag. And all main and visible page content is written inside <body> tag.

HTML Page Structure Example


What is attribute in HTML?

Attributes provide additional information inside HTML tags. HTML attributes are specified in the opening tag in the form of attribute name and value.

For example, HTML images can have width and height attributes to define the width and height of the image. Similarly, HTML links or anchor tag use href attribute to provide link address.

Syntax: <img src="my-picture.jpg" width="400" height="400">


What is the difference between DIV, SPAN & Paragraph tag in HTML?

What is the difference between DIV, SPAN & Paragraph tag in HTML?

<div> tag is the most common element to define a division and section. This is a block element which means it adds a line break before and after the content inside. Mostly, <div> tag is used to create content boxes and layouts in a website.

<span> an inline element, it only takes the required space in the same line and does not add line breaks. This is helpful for when we need to apply some styles to inline elements such as image, links or highlight piece of text.

<p> tag is used to defines paragraphs. The content written in paragraph adds some space before and after each element just like any document paragraphs.