HTML programming Interview Questions for beginners/experienced professionals from Codingcompiler. These HTML programming interview questions were asked in various interviews conducted by top multinational companies across the globe. We hope that these interview questions will help you in cracking your next HTML job interview. All the best and happy learning.
HTML Interview Questions
- What is HTML?
- Write an Example Program of HTML?
- Explain about the tags in HTML in brief?
- Do all html tags have an end tag?
- What is HTML5?
- What is Anchor tag and how can you open an URL into a new tab when clicked?
- Define Semantic elements in HTML.
- Define attributes in HTML tag.
- What are Attributes and how do you use them?
- When are comments used in HTML?
- What are the HTML tags used to display the data in the tabular form?
- Name some common lists that are used when designing a page.
- What Would Happen If The HTML Document Does Not Contain <!DOCTYPE>?
- What Is The Difference Between HTML Elements And Tags?
- Explian the new Features included in HTML5?
- What Are The Various Elements Provided By HTML5 For Media Content?
- What is a physical tag and logical tag in HTML?
- What is a nest in HTML?
- What is XHTML?
- What is Cell Spacing and Cell Padding?
- What browsers support HTML5?
- How to change the font colour in the HTML page?
- What is the Marquee tag?
- How to create an email enable text on the web page?
- What are applets?
- Applets program are written in which language?
- What is Longdesc in HTML?
- write a html code to build a table?
- What is Semantic HTML?
- Why are some characters often displayed as boxes?
- What’s the difference between ‘block’ and ‘inline’ elements?
- What is SVG element?
- What is a picture diagram?
- How change the font size in html?
- Why doesn’t <TABLE WIDTH=”100%”> use the full browser width?
- How would you automatically transfer your visitors to a new web page?
- What is a <dl> tag in HTML?
- What is difference between HTML and HTML5?
- What are the different types of entities in HTML?
- What are Web Standards?
Basic HTML Interview Questions And Answers
1. What is HTML?
HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a standard text formatting language which is used to create and display pages on the Web. It makes the text more interactive and dynamic. It can turn text into images, tables, links.
- Hyper Text: HyperText simply means “Text within Text.” A text has a link within it, is a hypertext. Whenever you click on a link which brings you to a new webpage, you have clicked on a hypertext. HyperText is a way to link two or more web pages (HTML documents) with each other.
- Markup language: A markup language is a computer language that is used to apply layout and formatting conventions to a text document. Markup language makes text more interactive and dynamic. It can turn text into images, tables, links, etc.
- Web Page: A web page is a document which is commonly written in HTML and translated by a web browser. A web page can be identified by entering an URL. A Web page can be of the static or dynamic type. With the help of HTML only, we can create static web pages.
Hence, HTML is a markup language which is used for creating attractive web pages with the help of styling, and which looks in a nice format on a web browser. An HTML document is made of many HTML tags and each HTML tag contains different content.
2. Write an Example Program/basic structure of HTML?
- <title>Web page title</title>
- <h1>Write Your First Heading</h1>
- <p>Write Your First Paragraph.</p>
3. Explain about the tags in HTML in brief?
Ans. HTML tags are composed of three things: an opening tag, content and ending tag. Some tags are unclosed tags.
- <!DOCTYPE>: It defines the document type or it instruct the browser about the version of HTML.
- <html > :This tag informs the browser that it is an HTML document. Text between html tag describes the web document. It is a container for all other elements of HTML except <!DOCTYPE>
- <head>: It should be the first element inside the <html> element, which contains the metadata(information about the document). It must be closed before the body tag opens.
- <title>: As its name suggested, it is used to add title of that HTML page which appears at the top of the browser window. It must be placed inside the head tag and should close immediately. (Optional)
- <body> : Text between body tag describes the body content of the page that is visible to the end user. This tag contains the main content of the HTML document.
- <h1> : Text between <h1> tag describes the first level heading of the webpage.
- <p> : Text between <p> tag describes the paragraph of the webpage.
4. Do all html tags have an end tag?
Ans. No, Only some tags are having closing tags.
5. What is HTML5?
Ans: HTML5 is the latest or updated version of markup language that defines HTML.
6. What is Anchor tag and how can you open an URL into a new tab when clicked?
Ans: Anchor tag in HTML is used for linking between two sections or two different web pages or website templates.
To open an url into a new tab in the browser upon a click, we need to add target attribute equal to blank.
<a href=”#” target=”blank”></a>
# = Link to be Given
blank = text to which hyperlink is given(Anchor text)
[Related Article: 11 The Best HTML Editors 2020]
7. Define Semantic elements in HTML.
Ans: Semantic elements are HTML elements which represent its meaning to the browser and developer about its contents.
For Example – p tag represents a paragraph, a tag represents anchor tag, form tag, table tag, article tag and many more are semantic elements in HTML. Whereas div tag, span tag, bold tag are not semantic elements.
8. Define attributes in HTML tag.
Ans: The HTML tag contains a field inside their tag which is called attributes of that tag.
- <img src=”#”> here in this tag src is img tag attributes.
- <input type=” text”> here in this tag type is input tag attributes.
9. What are Attributes and how do you use them?
Each tag has additional attributes that change the way the tag behaves or is displayed. For example, a <input> tag has a type attribute, which you can use to specify whether it’s a text field, checkbox, radio button or one of many more options.
Attributes are specified directly after the name of the tag, inside the two angled brackets. They should only ever appear in opening tags or in self-closing tags. But, they can never be in closing tags.
- <!– Text field –>
- <input type=”text” />
- <!– Checkbox –>
- <input type=”checkbox” />
- <!– Radio button –>
- <input type=”radio” value=”on” />
10. When are comments used in HTML?
Ans. To understand the code easily, you can add code comments to your HTML document. These are not displayed in the browser, but they help you in leaving notes for yourself and other developers as to what a section of HTML is for. The start of the comment is denoted by <!– and the end is marked by — >. Anything in the middle will be completely ignored, even if it contains valid HTML.
- <!– This is a comment! –>
- <!– Comments can span multiple lines too –>
- <!– This part is ignored in the browser →
Advanced HTML Interview Questions and Answers
11. What are the HTML tags used to display the data in the tabular form?
The list of HTML tags used to display data in the tabular form include:
|<table>||It defines a table|
|<tr>||This tag defines a row in a table|
|<th>||It defines a header cell in a table|
|<td>||This is used to define a cell in a table|
|<caption>||It defines the table caption|
|<colgroup>||It specifies a group of one or more columns in a table for formatting|
|<col>||This is used with <colgroup> element to specify column properties for each column|
12. Name some common lists that are used when designing a page.
Ans. There are many common lists used for design a page. You can choose any or a combination of the following list types:
- Ordered list – The ordered list displays elements in a numbered format. It is represented by <ol> tag.
- Unordered list – The unordered list displays elements in a bulleted format. It is represented by <ul> tag.
- Definition list – The definition list displays elements in definition form like in a dictionary.
The <dl>, <dt> and <dd> tags are used to define description list.
13. What Would Happen If The HTML Document Does Not Contain <!DOCTYPE>?
It instructs the Web Browser about the version of HTML used for creating the Web page.
If the developer misses declaring the DOCTYPE information in the code, then new features and tags provided by HTML5, like <article>, <footer>, and <header> will not be supported. Additionally, the Browser may automatically go into Quirks or Strict Mode.
14. What Is The Difference Between HTML Elements And Tags?
HTML elements communicate to the Browser how to represent the text. They become HTML tags when enclosed within angular brackets <>.
15. Explian the new Features included in HTML5?
HTML5 introduces a number of new elements and attributes that help in building an attractive webSite, that we see nowadays.
It supports following new features.
- New Semantic Elements – These are like <header>, <footer>, and <section>.
- Forms 2.0 – It contains improvements to HTML web forms. It has introduced new attributes for the <input> tag.
- Persistent Local Storage – With HTML5, it is possible to achieve this, without resorting to third-party plugins.
- WebSocket – It facilitates setting up a bidirectional communication for web applications.
- Server-Sent Events(SSE) – These events got introduced in HTML5. The direction of the flow of the execution of these events is from the server to the Web Browser.
- Audio & Video – It allows embedding audio or video on the web pages without resorting to third-party plugins.
- Geolocation – It facilitates the visitors to share their physical location with the web application.
- Microdata – It allows building our personal vocabulary beyond HTML5 and extends our web pages with those custom semantics.
- Drag and drop – It supports to Drag and drop the items from one location to another location on the same Web page.
16. What Are The Various Elements Provided By HTML5 For Media Content?
HTML provides the support of following elements for representing the media content.
- <audio> – It defines the sound content.
- <video> – It represents the video content that needs to be attached to a Web page.
- <source> – This tag defines the source of video and audio.
- <embed > – It provides a container for an external application.
- <track> – It defines text tracks for video and audio.
17. What is a physical tag and logical tag in HTML?
A Physical tag has physical text which is used to tell the browser how to display the text enclosed in the physical tag.
Example for the physical tags are: <big>, <b>, <i>
Logical tags are used to tell the meaning of the enclosed text in it. The example of the logical tag is <Important>….</Important> tag. When we enclose text in Important tag then it tell the browser that enclosed text is more important than other text.
18. What is a nest in HTML?
If you go and have a look at HTML markup for any webpage today, you will let to know that HTML elements are contained within other HTML elements. These elements which are inside of other are known as nested elements and they had become the essential part of building any web page nowadays. The most expertise way to know more about nesting is just to think about HTML tags in the form of boxes that hold your content which can be in form of text, images,etc.HTML tags are basically the boxes around the content.
19. What is XHTML?
Ans. XHTML stands for EXtensible HyperText Markup Language. eXtensible HyperText Markup Language is part of the family of XML markup languages. It mirrors or extends versions of the widely used HyperText Markup Language, the language in which Web pages are formulated. XHTML is almost identical to HTML. XHTML is stricter than HTML. XHTML is HTML defined as an XML application. XHTML is supported by all major browsers.
20. What is Cell Spacing and Cell Padding?
Cell Spacing is referred to space/gap between the two cells of the same table.
Cell Padding is referred to the gap/space between the content of the cell and cell wall or Cell border.
Cell spacing is one also used f formatting but there is a major difference between cell padding and cell spacing. It is as follows: Cell padding is used to set extra space which is used to separate cell walls from their contents. But in contrast cell spacing is used to set space between cells.
- <table border cellspacing=3>
- <table border cellpadding=3>
- <table border cellspacing=3 cellpadding=3>
Most Frequently Asked HTML Interview Questions
21. What browsers support HTML5?
All modern browsers support HTML5, however some older browsers do not. Luckily, most browsers will simply handle the new elements as inline elements. You can then use CSS to change certain elements to be displayed as block-level elements where needed.
22. How to change the font colour in the HTML page?
we can give this command for changing the font color
23. What is the Marquee tag?
For the scrolling text, we use a marquee tag. For Eg: <marquee>text</marquee>
24. How to create an email enable text on the web page?
For email enable text you have to write the following command in the web page. <a href=”mailto:emailaddress”>text to be clicked</a>
25. What are applets?
This is the frequently asked HTML Interview Questions in an HTML Interview. Applets are the small program which can be embedded with the web pages to perform some specific functionality like computation, animation.
24. Applets program are written in which language?
25. What is Longdesc in HTML?
Longdesc is an attribute that allows you to provide a Link to another page that contains a description of the frame contents. For example longdesc=”framedescription.html”.
26. write a html code to build a table?
By using <table> tag we create the table in HTML. For eg. If you want to create the table with 3 rows and 3 columns:
- <table style=”width:100%”>
27. What is Semantic HTML?
Semantic HTML is a coding style where the tags embody what the text is meant to convey. In Semantic HTML, tags like for bold, and for italic should not be used, reason being they just represent formatting, and provide no indication of meaning or structure. The semantically correct thing to do is use and . These tags will have the same bold and italic effects, while demonstrating meaning and structure (emphasis in this case).
28. Why are some characters often displayed as boxes?
This is quite an often occurrence – this happens because some certain characters might not be supported by the web browser that your operating system is running.
29. What’s the difference between ‘block’ and ‘inline’ elements?
Block elements are programmed so that they would take up as much space as possible. As opposed to that, inline elements are designed to take up a very minimal amount of space.
30. What is SVG element?
SVG is followed by the XML format; It has scalable vector graphics used to create vector graphics with interactive and animated support. Resolution is independent of SVG because it does not lose its size or rearrange its quality.
HTML Interview Questions and For Experienced
31. What is a picture diagram?
Answer: Image Map allows you to connect to various web pages using a single image. You can define the forms of images that you want to make part of the map mapping.
32. How change the font size in html?
In HTML, you can change the size of text with the <font> tag using the size attribute. The size attribute specifies how large a font will be displayed in either relative or absolute terms. Close the <font> tag with </font> to return to a normal text size.
33. Why doesn’t <TABLE WIDTH=”100%”> use the full browser width?
- This is because the graphical browser is designed to leave a margin between the display area and actual content.
- The navigator also leaves some space for the scroll bar on the right side of the display area. Though, if the page is not long enough, the scroll bar doesn’t appear.
34. How would you automatically transfer your visitors to a new web page?
– You can do it with the help of meta tag mentioned below:
<META HTTP-EQUIV=”Refresh” CONTENT=”2″; URL=”https://www.yourname.com”>
– Place this tag between <HEAD></HEAD>
– It will load yousite.com in 2 seconds.
35. What is a <dl> tag in HTML?
– <dl> is a definition list tag used in HTML.
– It is used with <dt> and <dd>.
– <dt> list the item while <dd> describes it.
36. What is difference between HTML and HTML5?
The differences between HTML and HTML5 are:
1. Document of HTML is very large as compare to the HTML5.
2. Audio and Video tags are not present in HTML whereas HTML5 contains audio and video tags.
3. Vector technology is not integral part of HTML whereas HTML5 Vector technology is the integral part of it.
4. HTML supported by all old browsers whereas HTML5 is supported by new browser.
5. In HTML web sockets are not available whereas in HTML5 Full duplex communication channel is present.
37. What are the different types of entities in HTML?
The different types of entities that are present in HTML are < (less than) or > (greater then). It allows the special or the reserved characters are matched with the source code and then it is saved.
The sample code is being given by:
There is always a concept associated with it that will create more simpler provision to avoid the spaces that are being coming in between the characters or the text.
38. What are Web Standards?
- Web standards are rules and guidelines established by the World Wide Web Consortium (W3C).
- Web standards are developed to promote consistency in the design code of a web page.
- It is the guideline for the mark-up language which determines how a web page displays in a visitor’s browser window.
- W3C (World Wide Web Consortium) standards promote the use of “Cascading Style Sheets” (CSS) or design code which is attached to the web page rather than embedded in the page.
- Search Engines are able to access and index pages designed to web standards with greater efficiency.
39. Can I nest tables within tables?
Yes, a table can be embedded inside a cell in another table. Here’s a simple example:
<td>this is the first cell of the outer table</td>
<td>this is the second cell of the outer table,
with the inner table embedded in it
<td>this is the first cell of the inner table</td>
<td>this is the second cell of the inner table</td>
The main caveat about nested tables is that older versions of Netscape Navigator have problems with them if you don’t explicitly close your TR, TD, and TH elements. To avoid problems, include every </tr>, </td>, and </th> tag, even though the HTML specifications don’t require them. Also, older versions of Netscape Navigator have problems with tables that are nested extremely deeply (e.g., tables nested ten deep). To avoid problems, avoid nesting tables more than a few deep. You may be able to use the ROWSPAN and COLSPAN attributes to minimize table nesting. Finally, be especially sure to validate your markup whenever you use nested tables.
40. Do I have to memorize a bunch of tags?
No. Most programs that help you write HTML code already know most tags, and create them when you press a button. But you should understand what a tag is, and how it works. That way you can correct errors in your page more easily.
RELATED INTERVIEW QUESTIONS
- Core Java Interview Questions
- JSF Interview Questions
- JSP Interview Questions
- JPA Interview Questions
- Spring Framework Interview Questions
- Spring Boot Interview Questions
- Core Java Multiple Choice Questions
- 60 Java MCQ Questions And Answers
- Aricent Java Interview Questions
- Accenture Java Interview Questions
- Advanced Java Interview Questions For 5 8 10 Years Experienced
- Core Java Interview Questions For Experienced
- GIT Interview Questions And Answers
- Network Security Interview Questions
- CheckPoint Interview Questions
- Page Object Model Interview Questions
- Apache Pig Interview Questions
- Python Interview Questions And Answers
- Peoplesoft Integration Broker Interview Questions
- PeopleSoft Application Engine Interview Questions