0% found this document useful (0 votes)
13 views

Complete_HTML_Interview_Questions

This document provides a comprehensive list of HTML interview questions and answers, covering fundamental concepts such as the definition of HTML, the structure of an HTML document, and the purpose of various tags. Key topics include block-level vs inline elements, semantic elements, forms, and the differences between HTML and CSS. It also touches on HTML5 features, local storage, and data attributes.

Uploaded by

krianlata160
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Complete_HTML_Interview_Questions

This document provides a comprehensive list of HTML interview questions and answers, covering fundamental concepts such as the definition of HTML, the structure of an HTML document, and the purpose of various tags. Key topics include block-level vs inline elements, semantic elements, forms, and the differences between HTML and CSS. It also touches on HTML5 features, local storage, and data attributes.

Uploaded by

krianlata160
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

HTML Interview Questions and Answers

1. What is HTML?

HTML stands for HyperText Markup Language. It is used to create the structure of web pages.

2. What are tags in HTML?

Tags are used to define elements in an HTML document, like <p>, <h1>, <div>, etc.

3. What is the structure of an HTML document?

An HTML document starts with <!DOCTYPE html>, followed by <html>, <head>, and <body> tags.

4. What is the purpose of the <!DOCTYPE> declaration?

It tells the browser which version of HTML the document is using.

5. What are block-level and inline elements?

Block-level elements take up the full width (like <div>, <p>), inline elements take only as much width as

needed (like <span>, <a>).

6. What is the use of <head> tag?

The <head> tag contains metadata like title, styles, and links to scripts or CSS.

7. What is the <body> tag?

The <body> tag contains the content that is displayed on the web page.

8. What are semantic elements?

Semantic elements clearly describe their meaning in a human- and machine-readable way, like <article>,
HTML Interview Questions and Answers

<section>, <footer>.

9. What is the use of <a> tag?

The <a> tag defines a hyperlink to another page or URL.

10. What is the difference between <ol>, <ul>, and <li>?

<ol> is for ordered lists, <ul> is for unordered lists, and <li> defines list items.

11. How do you insert an image in HTML?

Using the <img> tag with src and alt attributes. Example: <img src='image.jpg' alt='Image'>

12. What is the use of the <form> tag?

The <form> tag is used to collect user input with input fields, checkboxes, radio buttons, etc.

13. What is the difference between id and class in HTML?

id is unique to one element, while class can be used for multiple elements.

14. What is an iframe?

An iframe allows you to embed another HTML page within the current page using the <iframe> tag.

15. What is the <table> tag used for?

It is used to create tables. Includes tags like <tr>, <td>, <th>.

16. What is the use of <br> and <hr>?


HTML Interview Questions and Answers

<br> inserts a line break, <hr> inserts a horizontal line.

17. What are self-closing tags?

Tags that do not have closing tags. Examples: <br>, <hr>, <img>, <input>.

18. What is the use of the alt attribute in images?

It provides alternative text if the image can't load and helps with accessibility.

19. What is a hyperlink?

A hyperlink is a link from one page to another, created using the <a> tag.

20. What is the difference between HTML and CSS?

HTML is used to create structure; CSS is used to style the content.

21. What is HTML5?

HTML5 is the latest version of HTML with new tags like <video>, <audio>, <canvas>, and semantic elements.

22. What is local storage in HTML5?

It allows web applications to store data in the browser using JavaScript.

23. What is the purpose of the <meta> tag?

It provides metadata like character set, author, and viewport settings.

24. What are data-* attributes?


HTML Interview Questions and Answers

They are used to store extra information on HTML elements that can be used in JavaScript.

25. How do you create a checkbox or radio button?

Use <input type='checkbox'> or <input type='radio'> inside a form.

You might also like