50+ HTML Interview Questions and Answers 2023

Here are 50 or more of the most common HTML interview questions and answers that will help you pass even the most difficult interviews.

Table of Contents

1. Tell me what semantic HTML is.

Programming styles include semantic HTML. It\’s mostly using HTML Markup to make the meaning of the content clearer. Example: For bold statements in semantic HTML, we like to use the strong> Tag instead of the b> Tag. For italic statements, we prefer to use the em> Tag instead of the I Tag.

2. What is HTML\’s LongDesc?

Longdesc is an attribute that lets you link to another page that describes the contents of the frame. Longdesc=\”framedescription.html\” is an example.

3. Describe the cons of using the FRAME Tag.

1. Due to problems with Screen Resolution, some small devices like Tablets and Mobile Phones can\’t handle the content inside a FRAME Tag.
2. The Back button on your browser might not work as expected.
3.Depending on the Device, Web pages may sometimes be shown in a different way.
4. Only a small number of browsers don\’t work with FRAME Tags.

4. What does \”Cell Spacing\” mean?

Cell Spacing is an Attribute that tells an HTML Web Page how wide its borders are. It basically controls the space between the table cells. The Pixel Width is used to do this.

5. What is Get Form?

The data from the Form is put into a URL by the Browser. The data from the form can be seen in the URL, which makes it easier to save the page. The data in the form can only be ASCII codes.

6. What is a Marquee ?

Marquee is used on a Web page to show a scrolling text. The text you want to scroll should go inside the marquee>……/marquee> Tag. You can choose to give the Text and even the order of the Scroll a color.

7. How do I make an image the background of a web page?

You have to change the BODY Tag, which comes after the HEAD Tag, if you want a picture to be the background of a Web page.
For example: BODY Background=\’image1.png\’>
Background is an Attribute, and the Image Source is what it needs.

8. What does \”Cell Padding\” mean?
The space between the contents of a cell is set by the Cell Padding attribute. Its main purpose is to set the space between cells and within each cell. Cellpadding, on the other hand, shows the space between the content of a cell and its borders.

What\’s the difference between the SPAN and DIV commands?
DIV is a container or space that is usually used to arrange a group or single element. DIV is mostly used to make an area or block of text stand out on an HTML Web page so that styles can be applied to it. The DIV tag can also be used instead of the p> tag to make a logical break in an HTML document.

SPAN is used to change the way the elements in a SPAN block look. SPAN is used to select Inline Text and lets users apply different Styles to it. doesn\’t have its own box or space.

10. Explain Tags.

A Tag is mostly used to tell the Browser what it needs to do. When you write text on an HTML Web page, you usually put it inside of a Tag, which tells the Browser what it needs to do.

11. What\’s the difference between HTML and HTML 5?

HTML 1.0 had all the rules for how to show text and pictures on a Web page. It also involves giving Semantic data that lets HTML documents be automatically put into groups and linked to other documents.

HTML5 is not the same as HTMl5. It is more of an Application Development Platform that includes Text, Images, Video, Audio, Interactive 2D and 3D graphics, storing data in the application, Real-Time Networking, and a lot more.

12. What\’s a Button Tag?

The Button Tag works with HTML 5, which is the most recent version. It is mostly used to make a button on a web page using HTML form. If you click this Button, an Event will happen. It is usually used to make a button that says \”Reset\” or \”Submit.\”

13. What are Inline Element?

Inline Elements can go anywhere in a sentence and don\’t need to start on a new line. Tags like em>, ins>, I strong>, b >, sub>, big>, li>, del>, u >, and sup> can make this happen.

14. What does the SPAN Tag do?

SPAN is used to change the way the elements in a SPAN block look. SPAN is used to select Inline Text and lets users apply different Styles to it. doesn\’t have its own box or space.

15.  What\’s the difference between tags and HTML elements?

HTML elements are used to give the Web Browser information about how to display text. When HTML Elements are put between brackets (>), they become HTML Tags. Tags usually come in pairs and are placed around content.

16. Explain DIV Tag?

DIV is a container or space that is usually used to arrange a group or single element. DIV is mostly used to make an area or block of text stand out on a TML Web page so that styles can be applied to it. The DIV tag can also be used instead of the p> tag to make a logical break in an HTML document.

17. Explain META Tag?

Web browsers and search engines mostly use it to look for keywords. The meta> tag tells you things about an HTML document. Metadata is Data about Data. It is used to store information like \”Page Expiration,\” \”Page Author,\” \”Keyword List,\” and \”Page Description.\”

18. How do I add comments to HTML?

HTML is an SGML application, so SGML Comment Syntax is used. The full syntax is hard to understand, and most browsers don\’t work with it. So, a better way that is also shorter is:
An HTML comment:
<!–this is Comment–>

19.What does Form Post mean?

With Form Post, the name-value pairs are sent in the body of the HTTP message. You can\’t see the name-value pairs in the web browser\’s address bar. It doesn\’t have any rules about how long the string can be.

20. What\’s a script?

A script is a piece of software that can make your website more interactive. A script can be used to make a pop-up alert box or a drop-down menu. You can write short functions called \”Event Handlers\” in any scripting language, like VB Script or JavaScript, and then use HTML attributes to call those functions.

21. Can a single HTML document have more than one header on a Web page?

Yes. In a single HTML Document, there can be more than one Header. Most of the time, the HEADER Tag is used to do something related to its Parent section. So, a HEADER Tag can be part of a BODY TAG, an ARTICLE TAG, and a lot of other tags.

22. Explain FONT Tag.

The FONT Tag is used to change how a Web page\’s text looks and how big it is. There needs to be a Closing Tag. The FONT Tag and the BASEFONT Tag have been removed from HTM5, though. So, the best way to change the font is to use CSS. Color, Size, Face, etc. are all things that describe it.

23. What\’s the difference between cell spacing and cell padding?

Cell Spacing is an Attribute that tells an HTML Web Page how wide its borders are. It basically controls the space between the table cells. The space between the contents of a cell is set by the Cell Padding attribute. Cell Spacing is used to define the space between cells and also the space within each cell. Cellpadding is the space between the content of a cell and the edges of the cell.

List the features of HTML 5. 1. It allows for an extension to the JavaScript Application Programming Interface (API), which includes Caching, Geo-Locations, Storage, Drag and Drop, and much more.

2. The list of form controls has been updated to include time>, url>, calendar>, email>, date>, and search>.

3. Embedding Tags like video>, canvas>, and audio> make it easier to work with graphics, video, and audio data.

4. Semantic tags, such as main>, aside>, section>, nav>, header>, article>, and footer>, have been updated.

25. Can JavaScript Code be added to an HTML Web Page? If you said yes,then how?

<html><body>
<script type=\”text/javascript\”>
\’Test, HTML!\’
</script>  </body>  </html>

Add the Internationalization Attributes for XHTML Element to your list.
1. XML: Lang
2. DIR
3. LANG

27. What does CSS mean?

Cascading Style Sheets is what CSS stands for. It gives you simple and effective ways to set different attributes for HTML Tags. With CSS, you can give any HTML element a Style property. You don\’t have to put the same information on each Web page. Instead, you can make a.CSS file and put the information there. It will be added to every.HTML Web page by itself.

28. What\’s the difference between Form Get and Form Post?

Get
The data from the Form is put into a URL by the Browser. The data from the form can be seen in the URL, which makes it easier to save the page. The data in the form can only be ASCII codes.

Post
With Form Post, the name-value pairs are sent in the body of the HTTP message. The name-value pairs can\’t be seen in the bar at the top of a web browser. It doesn\’t have any rules about how long the string can be.

Form Post and Form Get are mostly different HTTP requests, and they are sent in different ways. Since the data is encoded in different ways, you may need to use different decoding methods.

29. Get the Form Elements on your side.

There are different form elements, which include the following:
1. Text Fields
2. Textarea field
3. Pull-down menus
4. Radio buttons
5. Boxes to check

30. What does the DOCTYPE tag in HTML mean?

It says that it is about the Document Type Definition. It talks about the rules for the Markup Language that the Browser needs to follow so that the Content is shown correctly. In HTML5, you no longer have to use DOCTYPE. But it has to go before the HTML Tag, which means it has to be on the first line of any HTML document. It is not an HTML Tag, but rather an instruction to the Web Browser about which version of the Markup Language the Web Page is written in.

31. Explain XHTML.

Extensible HyperText Markup Language is what XHTML is short for. It is nearly the same as HTML. When it comes to syntax, it is stricter than HTML. XHTML is a form of HTML that adds the XML (Extensible Markup Language) application. The best thing about XHTML is that all of the major Web browsers can read it.

32. What is IFRAME tag?

IFRAME Tag is used to put a document inside an HTML document. But the IFRAME Tag is no longer supported by the most recent changes to HTML 5, so you shouldn\’t use it.

33. What kinds of file extensions does an HTML Web page use?

An HTML document has the following extensions: 1..html 2..htm
But you should stick with the.html format because it is the norm and looks better.

34. Do all HTML Tags have an Ending Tag?

No. Ending Tags are at the end of most of them. But there are some tags, like BR/> and HR/>, that don\’t need an Ending Tag. For these two Tags, you don\’t have to use an ending tag.

35. What are some of the most common Lists used when making an HTML Web page?

There are many different kinds of lists that can be used to make a page. You can choose any combination of the following list types, or even just one:
1. Definition List
2. Menu List
3. Ordered List
4. List of places
5. Unordered List

36. What\’s a Box Model?

Every Element on a Page is a rectangular box that can have Width, Height, Padding, Borders, and Margins. Every part of the box model has something to do with a CSS property, including the width, height, padding, border, and margin.

37. How do you put an image and different attributes into an HTML document?

Using the IMG Tag, you can put any image into an HTML document. It uses a lot of different features that help show off the picture better. Like other Tags, this one doesn\’t need an Ending Tag.

<img src=\”yourimagename.png\” alt=”coderazaa” height=50 and width=50>

38. What are Hyperlinks?

Hyperlinks have information that leads to another URL. It makes it easy for people to move between different websites or pages on the same website. It can link to text or an image on a Web page.

39. How does Noresize work?

Inside of Frames, the noresize attribute is used. It\’s used to stop a user from changing the size of a Frame in an HTML document. But by default, you can change the size of a Frame by clicking on its edges and dragging them.

40. What is a Block Element?

In terms of a Bloc, these are the things that show up on the screen. Before and after the beginning and ending tags, there is a line space. They begin with a new line.
Tags like HR, ADDRESS, HEADING, OL, PRE, BLOCKQUOTE, and DL are used for Block Elements.

41. What is an HTML form?

When you want to get information from a visitor, you need to use an HTML form. It is used to get information like your name, email address, credit card number, and so on. A form will ask the visitor for information and send it to a back-end application like CGI, ASP Script, PHP Script, etc.

42. What is EMBED Tag?

Embed Tag lets you add a video or audio file to an HTML document. The Embed Tag needs to be closed. It needs the source of the video or audio file that needs to be shown on the page.
This is how it works: EMBED> Source File /EMBED>

43. What does the word \”Pseudo Classes\” mean?

Some HTML elements, like Hover Actions, Link Colors, and a few others, can have their effects improved by using a Pseudo Class. A Pseudo Class in HTML is the same as a normal class. The only difference is that it is not defined in the HTML Markup. To define a Pseudo Class, you put the Selector, a colon, and the Class Element in the same line.

44. Describe how the Z index works.

When you use CSS to place elements in an HTML file, there is a chance that they will overlap. Z Index is used to make sure that this doesn\’t happen. It\’s basically an integer, and it can have both positive and negative numbers in it. The default value is Zero.

45. Describe how CSS can be used in HTML documents.

CSS styles can be added to HTML documents in the following ways:
INLINE: This is the best way to style a single element in an HTML document. You just need to put the STYLE Tag inside a Paragraph Tag like p> or a> to define it.

INTERNAL: Internally, this is done by putting attributes inside a STYLE tag and defining the HEAD of an HTML document.

EXTERNAL: You can do this by making a separate.CSS file and putting a link to it in the HTML file. This can make it take longer for a page to load.

46. Write down the problems with external style sheets:

1. Importing style information from a relative.CSS file into each HTML file takes more data to download.
2. You can\’t render an HTML document if the Style Sheet isn\’t loaded correctly.
3. You shouldn\’t use an external CSS file if you only have a few Style Definitions on a single page.

47. What does \”float\” mean in a cascading style sheet?

Use the Float property if you want to move an image to the left or right of an HTML page along with its caption text or any other text that is wrapped around it.

48. What does CSS Selector mean?

HTML Element can be replaced with CSS Selector, which is the same thing. It works like a String that tells you which Elements a declaration will affect. It can also be a group of statements. You can think of a selector as a link between an HTML document and a Style Sheet.

49. Describe what Image Sprites are in CSS.

An Image Sprite is a single image that is made up of more than one image or a group of images. Since loading each image on a Web page takes time, it is better to use Sprite Images instead. This makes the page load faster.

50. Find out why embedded style sheets are good.

No extra downloads from outside sources.
Since CSS is needed, the page loads faster and takes less time to load.
So, it\’s possible to make more than one tag in a single HTML document.
Styles can be put into place using both grouping methods and Selectors.

What\’s the difference between a Class Selector and an ID Selector?
A Class can be linked to more than one HTML element, but an ID Selector can only be linked to one element in a single HTML document.

52. Describe what logical and physical tags are.

Logical Tags are an old idea in HTML, and they are mostly used to change the way content looks. Logical tags are now less important than they used to be because Physical Tags have moved forward. Physical Tags are used a lot for presentational mark-up, and they look better in an HTML document.

So, that was the list of important HTML interview questions and answers. If you found something wrong or missing on the list above, please let us know by leaving a comment below.

Related Posts
45+ VB.Net Interview Questions and Answers 2023

Here are 45+ of the most common VB.Net interview questions and answers that will help you pass one of the Read more

50+ Core Java Interview Questions and Answers 2023

Here are 50 or more of the most common core Java interview questions and answers that will help you pass Read more

50+ Python Interview Questions and Answers 2023

Here are 50 or more of the most common Python interview questions and answers that will help you pass one Read more

50+ C++ Interview Questions and Answers 2023

Here are 50+ common C++ interview questions and answers that will help you get through one of the toughest interviews. Read more

50+ PHP Interview Questions and Answers 2023

1. Differentiate between static and dynamic websites. Static Website The content cannot be modified after the script is executed The Read more

Top HR Interview Questions and Answers in 2023

To get your dream job, you need a strong resume and technical skills, but you also need to be able Read more

Interview Advice

The most important Interview Advice for a job candidate in the job interview. If you have an interview, you need Read more

Competency based interview questions and answers

Here we help you with Competency based interview questions and answers list. The candidates are asked competency-based interview questions to Read more

Scroll to Top