HTML Interview Question
Tags: html, beginners, tutorial, programming
Published: 2022-01-13 14:26:05

HTML is one of the most widely used languages on Web to develop web pages. It helps you delve into the world of Web Development and improve your skills. So, if you are planning to start your career in Web Development or HTML and you wish to know the skills related to it, now is the right time to dive in. These HTML Interview Questions and Answers will help you get through your interviews in 2022.

**01. What are the differences between HTML4 and HTML5?**
ANS: HTML stands for Hypertext Markup Language. HTML4 is The 4th & Older  Version OF HTML AND  HTML5 is The 5th & New Version With Advanced Features. HTML4 was Published in 1997 as a W3C Recommendation. On The Other hand, HTML5 Published in 2008 as a WWW Consortium (W3C) Recommendation. Also There are some Major Difference Between Features/Tags provision/Error Handling.

---

**02. What are semantic tags in html? Give me some examples.**
ANS: Semantic Tags Means, Which Clary Describe Human & Machine Readable Way. It has greater accessibility and easier to read. Semantic Tags Come With HTML5. List of semantic Tags, `<article>`, `<aside>`, ,`<details>`, `<figcaption>`, `<figure>`,` <footer>`, `<header>`, `<main>`, `<mark>`, `<nav>`, `<section>`, `<summary>`, etc.

---

**03. What is the purpose of `Article`, `div`, `section`, `nav`, `aside`?**
ANS: The Purpose Of Article Tag is to represent an article. It is independent, self-contained content. This Tag is from The New Semantic Tags. As well as the Article tag. div, section, nav, aside tag also from the semantic tag. Normally Div Tag is known As A Division Tag. We Are Using This Tag For Making Divisions of Content in The Web Pages. When We Need To Group Some Contents, That Time We USE Section Tag. Generally We use Nav Tag For Navigation. ‘Aside’ For Sidebar.

---

**04. Why will you use Meta tag?**
ANS: Normally People Use Meta Tag For Solid SEO Purpose & Ranking. And Also, We Store Data About This Website, Description. It Defines Meta Data About an HTML Document. Meta Tag is Self-Closing Tag.

---

**05. What is the difference between `inline`, `inline-block`, and `block`?**
ANS:  All of Those Are Display Elements. Inline Elements Doesn’t have any fixed width & height. Examples, `a/span/img` tags. 
Inline-block Also have not any fixed width, But We Can Add Width/Height. Block Elements Have Full width & It starts With A New Line. Although, We Can set width/height also. Examples, `h1/p/div/section`.

---

**06. Difference between `strong`, `b`, `bold`, `em`, `i`?**
ANS: There are very small differences in all of those tags. Basically in Strong & Bold Tag, there is no difference visually. BUT we use strong tags for showing that this element is more important and It’s Meaningful Word. And Let’s Find Difference between `em `& `i` Tag. `i `Tag Stand For `italic `and `em `tag stands for emphasis. `i` tag use, When you just need to show a unique word from your text. And `em` tag use, when you need to show More attention to this word. 

---

**07. What are properties and attributes in HTML?**
ANS: We use Properties and attributes in HTML for Adding Additional information to this html tag. Like,` href`, `src`, `target`, `name`, `placeholder`,  etc.

---

**08. What is  a Viewport?**
ANS: It’s A browser viewport. This is  the user's visible area of a web page. Normally we use this for responsiveness of our web page area. 

---

**09. What is SVG?**
ANS: SVG stands for Scalable Vector Graphics. We Can USE Directly SVG by `<svg><svg/>` Tag. It's a XML based two-dimensional graphic file format. We Can Also Use svg images for our web page design. This Tag Also Has attributes. 

---

**10. List the media types and formats supported by HTML.**
ANS: Media Types Format Are Come From HTML5. It’s semantic Tags. I will show some formats about multimedia, which are supported by HTML5. For Video Formats, `.mpg`, `.mpeg`, `.avi`, `.wmv`, `.mov`, `.rm`, `.ram`, `.swf`, `.flv`, `.ogg`, `.webm`, `.mp4`, etc. For Audio Formats, `.mid`,` .midi`, `.rm`, `.ram`,` .wma`, `.aac`, `.wav`, `.ogg`, `.mp3`,`.mp4`, etc.

---

**11. What is the difference between HTML and XHTML?**
ANS: HTML Stands For Hypertext Markup Language. XHTML Stands For Extensible HyperText Markup Language. HTML displays data and describes the structure of a webpage, whereas XML stores and transfers data. XHTML is Better For Error handling. XML is dynamic and case sensitive. On the other hand, HTML is static and not case sensitive.  
 
---
 
**12. What are HTML Entities?**
ANS: An HTML entity is used to display invisible characters(like non-breaking spaces) and that doesn't belong to the document's character set. It is a piece of text, or string, that begins with an ampersand ( & ) and ends with a semicolon ( ; ). Example:   & - (&amp;)  " -  (&quot; )

---

**13. Describe HTML layout structure.**
ANS: These  layouts provide a way to arrange web pages in , well-structured, and in responsiveness. `<header>` `<nav>` `<section>` `<article>` `<aside>` `<footer>`. Those Tags Are Used For HTML Layout Structure.
 

---
 
**14. Difference between link tag `<link>` and anchor tag `<a>`?**
ANS: The link tag is used to define a link between a document and an external resource. The `<a>` tag defines a hyperlink. A link is that a link takes to another page And A link is that a link takes to another page.

---

**15. Is drag and drop possible using HTML5 and how?**
ANS: From HTML5 it is possible to drag and drop HTML elements inside an HTML page. There are a number of events which are fired during various stages of the drag and drop operation. These events are listed below − `dragstart`,  `dragenter`,  `dragover`,  `dragleave`, `drag`, `drop`, `dragend`.