HTML Interview Questions | Recently Asked Questions and Answers – Part 1

HTML Interview Questions and Answers – Part 1

Here are Some Recently Asked Important HTML Interview Questions

1. What is the Full form of HTML?

HTML stands for Hyper Text Markup Language.


2. What are HTML Elements?

Elements enclose the contents in between the tags. It generally consists of a start tag, content, and an end tag.


3. What is the structure of HTML code?

An HTML document is composed of three parts:

  • A line containing HTML version information.
  • A declarative header element.
  • body, which contains the document’s actual content.


4. What are the HTML important parts?

  • An HTML document is composed of three parts:

    • A line containing HTML version information.
    • A declarative header element.
    • A body, which contains the document’s actual content.


5. What is the extension of the HTML file?

  • The extension of the HTML files is .html


6. What are structured elements in HTML5 ?

  • Following are the structural elements in
    • header: Used to contain the header of a webpage.
    • footer: Contains the footer of a webpage.
    • nav: Contains the navigation functionality for the page.
    • article: The article tag is one of the new sectioning elements in HTML5. The HTML article tag is used to represent an article. More specifically, the content within the article tag is independent of the other content of the site (even though it can be related).
    • section: Used to either group different articles into different purposes or subjects, or to define the different sections of a single article.
    • time: Used for marking up times and dates.
    • aside: The aside tag defines some content aside from the content it is placed in.
    • hgroup: The hgroup tag in HTML stands for heading group and is used to group the heading elements.
    • figure: The figure tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.


7. Difference between HTML and HTML5?

HTML is referred to as the primary language of the World Wide Web. HTML5 supports both audio and video.
HTML has many updates over time, and the latest HTML version is HTML5. HTML cannot allow JavaScript to run within the web browser, while HTML5 provides full support for running JavaScript.
It uses cookies to store temporary data. It uses SQL databases and application cache to store offline data, It allows drag and drops effects. HTML5 supports new types of form controls, such as date and time, email, number, category, title, Url, search, etc.
It does not allow drag and drop effects. Many elements have been introduced in HTML5. Some of the most important are time, audio, description, embed, fig, shape, footer, article, canvas, navy, output, section, source, track, video, etc.
Older version of HTML is less mobile-friendly. HTML5 language is more mobile-friendly.


8. What are the new features of HTML 4 and HTML 5?

New Features of HTML 4 New features of HTML5
New Elements in HTML 4.0 Video and Audio
Separation of Structure and Presentation nav
Accessibility header
Internationalization canvas
Style Sheets footer
Client-side Scripting New types for input tags
Frames Figure and figcaption
Advanced Tables Placeholders


9. What is the meaning of doctype! at the top of the HTML document and is it necessary or not?

  • The declaration is not an HTML tag. It is information to the browser about what document type to expect.

  • It is important to instruct the web browsers about the version of the HTML page. Html doctype should be declared very first before any tags.


10. What are the types of tags in HTML?

  • HTML tags can be of two types:

    • Paired Tags

    A tag is said to a paired tag if it along with a companion tag or closing tag appears at the end. In paired tag, the first tag is called the opening tag and the second tag is called the closing tag.

    • Singular Tags

    The second type of tag is the singular tag, which is also known as a stand-alone tag or empty tag. The stand-alone tag does not have a companion tag or closing tag.


11. Difference between HTML Tags and HTML Elements?

HTML Tags HTML elements
Tags are the starting and ending parts of an HTML element. They begin with < symbol and end with > symbol. Whatever is written inside < and > are called tags. Elements enclose the contents in between the tags. They consist of some kind of structure or expression. It generally consists of a start tag, content, and an end tag.


12.What are the uses of HTML?

  • HTML describes the structure of Web pages. It tells the web browser what each part of a webpage is.
  • So, using HTML, you can define headers, paragraphs, links, images, and more, so your browser knows how to structure the web page you’re looking at.

13. What is HTML?

HTML (Hypertext Markup Language) is the code that is used to structure a web page and its content. For example, content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables.


14. If div and p elements are given how will you move the p element to the top left corner?

Different ways are there for moving elements to the top left corner using positions.



<div>This div element has position: static;</div>
<p class=“para”>
An element with position: static; is not positioned in any special way; it is
always positioned according to the normal flow of the page:
.para {
position: fixed;
top: 0;
left: 0;

15. How to get two div elements in a single row?

  • Ways to get two div elements in a single row.

    • Apply display property value as inline for both div elements.
    • Wrap 2 div elements in another div and use display property flex and direction row.


16. Can HTML5 support drag and drop of elements? If yes then how?

  • Yes, in HTML5 we can drag and drop an element. This can be achieved using the drag and drop related events to be used with the element which we want to drag and drop.

  • Drag and Drop are the HTML5 APIs that allow the user to grab any object on the page, drag it and drop it to a different location.

Drag Drop
The user is only able to drag those HTML elements which have the draggable attribute. The drag object of the page can only drop to some specific location where the ondragover event is specified.

<img draggable=’true’/ src=’img.png’>
Example :

<div ondragover=”allowDrop(event)”></div>


17. What are advantages and disadvantages of HTML?

Advantages of HTML:

  • HTML is Easy to Learn and Use
  • HTML is free of cost
  • Most browsers support HTML
  • HTML is the Most Friendly Search Engine
  • HTML can Integrate Easily with Other Languages

Disadvantages of HTML:

  • HTML cannot produce dynamic output alone, since it’s a static language.
  • Security features are not good at HTML.

Related Posts

Bootstrap Interview Questions and Answers | Part-1

Bootstrap Recently Asked Interview Questions and Answers 1. Explain what is Bootstrap and why it is used and its importance? Bootstrap is a large collection of predefined…

Leave a Reply

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