Top HTML Interview Questions and Answers for Freshers/ Experienced
Tejasvee Sharma
Dec 19, 2021
If you are appearing for a Web designer, Web Developers job interview then HTML is a must. Here we have brought you the top 50 HTML Interview Questions and Answers to practice. These HTML interview questions are generally asked in all technical job interview questions so it is important to prepare them well. On this page, you’ll get HTML interview questions and answers for freshers and experienced candidates for your better preparation.
About HTML: HTML full form HyperText Markup language. It is released in 1993 as a standard text formatting language utilized to develop web pages. It is a programming language that is decoded by the browser and informs it what to show and how to show. It makes the visuals appealing by using text, images, audio, video, graphics, etc.
HTML means HyperText Markup Language. It is a World Wide Web standard text formatting language that is used to make and portray pages on the Web. It creates the text more interactive and vibrant. It can turn text into tables, images, and links.
2. Explain Tags?
HTML tags are formed of three things: starting tag, content, and ending tag. Some of the tags are left unclosed. HTML documents include two things:
• content, and
• tags
When a browser goes through an HTML document, the browser reads the document from top to bottom and left to right. They are used to make HTML documents and yield their properties. Every HTML tags contain different properties.
Syntax
content Content is kept between tags to show the data on the web page to the user.
3. Is all HTML tags have an ending tag?
No. There are some unclosed HTML tags that do not require any closing tag. Such as: tag, tag.
4. What do you understand by formatting in HTML?
HTML formatting is a procedure of formatting and placing the text for a better appearance and feel. For this HTML use different tags to look at the text bold, italicized, underlined, or any required formatting.
5. Describe types of heading in HTML?
In HTML, there are six types of headings which are represented with the
to
tags. Each heading tag i.e.
,
…
and
shows a different text size from each other. So,
have the biggest heading tag and
is the smallest one. For example:
Heading no. 1
Heading no. 2
Heading no. 3
Heading no. 4
Heading no. 5
Heading no. 6
6. How to form a hyperlink in HTML?
The HTML gives an anchor tag to make a hyperlink that connects one page to another page. These HTML tags can occur in any of the given ways:
• Unvisited link: It is shown underlined, and blue.
• Visited link: It is shown underlined, and purple.
• Active link: It is shown underlined, and red.
7. Explain HTML tags used to show data in the tabular form?
To create a table in HTML, a table tag is used to show data in tabular form that is row and column. It also controls the format of the page like navigation bar, header section, body, and footer section. Some of the tags used to show the data in the tabular form are:
Tag Description
It represents a table.
It represents a row in a table.
It represents a header cell in a table.
It represents a cell in a table.
It represents the table caption. It defines a group of one or more columns in a table.
It is used with tag to define column properties for each column.
It groups the body content in a table.It groups the header content in a table.
It groups the footer content in a table.
8. Tell some common lists used to design a page?
Some of the common lists are used to create a page are:
• Ordered list: The ordered list shows elements in a numbered format like 1., 2., 3. It is defined bytag.
• Unordered list: The unordered list shows elements in bulleted format (as this bulleted list is given). It is defined by
tag.
• Definition list: The definition list shows elements in definition form as in dictionary. The
,
and
tags are used to represent description list.
9. Differentiate between HTML elements and tags?
HTML elements correspond to the browser to induce text. When these elements are closed within brackets <>, they become HTML tags. Mostly, tags arrive in a pair of open and close and wrap content.
10. Explain semantic HTML?
It is a coding style that uses HTML markup to support the semantics or meaning of the content. Like, in semantic HTML tag is not used to bold statement same as tag is not used for italic the text but they use tag for bold and tag for italic.
11. Explain the image map?
Image map enables you to link various web pages by using a single image. It is defined by
12. Show us the way to insert a copyright symbol on a browser page?
To show a nested webpage in HTML, an iframe tag is used. In other terms, it displays a webpage within a webpage. The HTML
HTML Iframes example
Use the height and width attributes to specify the size of the iframe :
14. What do you use to keep list elements straight in an HTML file?
By using indents, we can maintain the list of elements straight in an HTML file.
15. Is hyperlink only applicable to text?
No, text and images both can be used for hyperlinks. The HTML anchor tag represents a hyperlink that connects one page to another page. The “href” attribute is used for the HTML anchor tag.
Syntax
Link Text
16. Explain a style sheet?
It is used to create a uniform, transportable, and well-designed style template. You can use the style sheet templates on various web pages. It represents the appearance and formatting of a document written in a markup language.
17. How will you create multi-colored text on a web page?
We use tag for that particular texts you want to color.
18. Can we change the color of the bullet?
The bullet color is always similar to the color of the first text of the bulleted list. So, if you are looking to change the bullet color, you have to change the color of the first text.
19. What is the layout of HTML?
HTML layout defines a way in which the web page is positioned. Every site has its particular way to show content in a clear manner. These are different HTML5 elements that are responsible to define the various parts of a webpage.
•: It represents a header for a document or a section.
•
20. Explain a marquee?
It is used to add scrolling text on a web page. It scrolls the text or image up, down, left, or right positions automatically. To scroll the text you have to put it within the tag.
21. Explain the tags used to separate a section of texts?
• tag: It is used to split the line of text. tag breaks the existing line and brings the flow of text to the next line
•
tag: The
tag is paragraph tags that add the text in the form of a new paragraph.
•
tag: It shows a large quoted section. You can put a large quotation within
………….
tag.
22. How to use a picture as a background image of a web page?
To use a picture as a background image on a web page, we need to use the following tag code after the closed headtag.Here, change the "image.gif" with the image file name which you want to show on your web page.
23. Explain empty elements?
HTML elements that have no content are known as empty elements. For example: ,etc.
24. Tell the use of a span tag?
The span tag is used to:
• Add color to text
• Add background on text
• Highlight any color text
Example:
In this page we use span.
25. Tell the use of an iframe tag?
It shows a web page within a web page. Syntax:
< iframe src="URL"> Example:
< iframe src="demo_iframe.html” width="200px” height="200px"> Target to a link:
The HTML character entities are used as an alternate for secured characters in HTML. You can also change characters that are not available on your keyboard with entities. These characters are changed because some characters are secured in HTML.
27. Why URL is encoded in HTML?
An URL is encoded to transform non-ASCII characters into a structure that is used on Internet as a URL is transmitted over the Internet by using the ASCII character-set only. If a URL includes characters beyond the ASCII set, the URL has to be transformed. The non-ASCII characters are changed with a “%” observed by hexadecimal digits.
28. Is <!DOCTYPE html> tag is a HTML tag?
No, the tag is not an HTML tag. There are several type of HTML like, HTML 4.01 Strict, HTML 4.01 Frameset, HTML 4.01 Transitional, XHTML 1.0 Strict, XHTML 1.0 Frameset, XHTML 1.0 Transitional, XHTML 1.1 etc. So, is used to guide the web browser related to the HTML page.
29. Explain the canvas element in HTML5?
The
30. Explain SVG?
HTML SVG defines the 2D vector and vector/raster graphics. SVG images and their behaviors are represented in XML text files. So by using XML files, you can make and change an SVG image with the text editor. It is used to make vector-type diagrams like pie charts, 2D graphs in an X, Y coordinate system.
31. Name various new form element types in HTML 5?
• Color
• Date
• Datetime-local
• Email
• Time
• Url
• Range
• Telephone
• Number
• Search
32. Do we need to change the web browsers to make HTML5 work?
No. Almost all updated versions of browsers support HTML 5. Such as Chrome, Opera, Firefox, Safari, IE.
33. Name some type of video formats supported by HTML5?
• mp4
• WebM
• Ogg
34. Is HTML5 supports audio tags?
Yes. The audio tags are used for sound or music files on the web page. There common supported file formats are.
• mp3
• WAV
• Ogg
Let’s see the code to add and play audio mp3 file.
35. Differentiate between progress and meter tag?
The progress tag shows the progress of the task whereas the meter tag is measures data in a provided range.
36. Explain the figure tag usage in HTML 5?
To add a photo to the document on the web page, the figure tag is used. It is used to manage diagrams, code listing, photos, with some embedded content.
The Taj Mahal is one of the seven wonders of the world."
37. Tell me the use of the figcaption tag in HTML 5?
Thetag provides a caption to an image. It is an optional tag and can be added after or before the content in the
38. Explain a button tag?
It is used to make a button clickable in the HTML layout on the web page. It creates a “reset” or “submit” button. Let’s see the code to show the button.
39. Explain details and summary tag usage?
The details tag tells some extra details on the web page. It can be shown or hidden on demand. The summary tag cab also is used with a detailed tag.
40. Explain the datalist tag?
The HTML 5 datalist tag gives an autocomplete feature means shows the predefined suggestion on the form element. It enables users to select the predefined choices to the users to select data.
41. Differentiate “display: none” and “visibility: hidden” as attributes?
In the HTML element, whenever we use the attribute “visibility: hidden” then that element hides from the webpage but still consumes space. Whereas, if we operate the “display: none” attribute then the element hides without taking up any space on the webpage.
42. If I don't add <!DOCTYPE html> in HTML 5, then will it work?
No, if the browser is not able to search that it is an HTML document and HTML 5 then the tags won’t work properly.
43. Tell me the usage of the required attribute in HTML5?
It compels a user to fill text in the given text area or text field before submitting the form. It is used to validate the form.
Example:
Name:
44. Tell some new <input> types for validating a form in HTML5?
The new input types for validating a form in HTML5 are email, URL, number, telephone, and date.
Example:
45. Explain void elements in HTML?
HTML elements which do not possess any closing tags or don’t require any ending are Void elements. Such as: , ,, etc.
46. Explain the ‘class’ attribute in HTML?
The class attribute determines the class name for an HTML element. More than one element in HTML can hold the same class value. It is primarily used to associate the styles documented in the stylesheet with the HTML elements.
47. Differentiate the ‘id’ and ‘class’ attributes of HTML elements?
Numerous elements in HTML can contain the same class value, but a value of the id attribute of a single element can’t be associated with a different HTML element.
48. Explain multipart form data?
It is the value of the enctype attribute that is utilized in sending the file data to the server-side for handling. The additional valid values of the enctype attribute are text/plain and application/x-www-form-urlencoded.
49. Merge two or more rows or columns into one row or column in an HTML table?
HTML gives two table attributes “colspan” and “rowspan” to create a cell span to multiple rows and columns respectively.
50. Can we alter an inline element into a block-level element?
Yes, by using the “display” property with its value as “block”, we can alter an inline element into a block-level element.