Home >>Interview Questions >HTML Interview Questions

HTML Interview Questions

Q1. What is HTML?

Hypertext Markup Language or HTML is a markup language of World Wide Web. It is a standard text formatting language which is used to create webpages and display website pages on the web. You can save the HTML pages by adding .htm or .html.

Q2. What is HTML5?

HTML5 is the fifth version of HTML. It is a standard for structuring content on the web pages. HTML5 has removed or modified many elements. It also handling inaccurate syntax.

Q3. What are the some new features of HTML5?

Many new elements are added in HTML5 like nav, audio, embed, progress, command, time, summary, video, output, figure, meter, data, section, time, aside, canvas, rp, rt, details, figcaption, header, footer, article, hgroup, bdi, mark, source, track, section etc.

Q4. What are tags?

Most tags must have two parts: opening tag and closing tag and text are written inside these tags. But closing tag needs an additional forward slash( / ).

For example:

<h1>text goes here…</h1>

Q5. How many types of heading used in HTML?

There are six types of heading <h1> to <h6> you can used in HTML. <h1> display largest heading and <h6> display small heading to the web page.

For example:

<h1> First heading</h1> 
<h2> Second heading</h2> 
<h3> Third heading</h3> 
<h4> Fourth heading</h4> 
<h5> Fifth heading</h5> 
<h6> Sixth heading</h6> 

Q6. Is all HTML tag have an end tag?

No, there are two tags which don't have an end tag <img> and <br> tag.

Q7. What is the purpose of HTML5 'Nav' tag?

HTML5 ‘nav’ tag represents the menu bar on the top of the web page. It helps user easily go to the page where he want to go.

Q8. What are the lists that are used in HTML when designing a page?

These are the common list you can use in HTML:

Note: Each list item starts with <li>tag.

  • Ordered list (ol) - The list items display numbers to each <li>tag.
  • Unordered list (ul) - The list items display bullets to each <li>tag.
  • Description list (dl) – It is used to describe each list tag. It also includes <dt> tag defines the name and <dd>tag defines each term. These tags are used to define description list.

Q9. What is attributes in HTML tags?

Attributes are used inside the HTML tags. You cannot use attributes in all tags but some tags needs attributes like-

<img src="">
<input type="">
'Src' and 'type' are called attributes in HTML.

Q10. How can we comment in HTML?

Comments are used by developers in understanding the code functionalities. It is also helpful for other developers to easily read the code.

There are two types comments used in HTML:

<--single line comment-->
Multiple line comment- <! -- Text goes here…. Text goes here -->

Q11. Is it necessary to use <! DOCTYPE> in HTML5?

<! DOCTYPE> is an instruction to the web browser about the version of markup language in which the HTML page is written in. the <! DOCTYPE> tag does not need an end tag and it is not case sensitive.

Q12. What are the way to insert a copyright symbol on a browser page?

By using © and © in an HTML file, you can insert a copyright symbol on a browser page.

Q13. If <! DOCTYPE html> not written will HTML 5 work?

No, the browser is not be able to read the page that the document is written in HTML or HTML5 that’s why tags do not function properly.

Q14. What is button tag?

It is used to create a clickable button on the web page. The button tag is introduced in HTML 5. Generally button is used in forms to submit or cancel the details.

Q15. HTML 5 supported which type of video formats?

Three types of video formats supported by HTML 5:

  • WebM
  • mp4
  • Ogg

Q16. What is marquee in HTML?

Marquee tag is used for scrolling the text or image on the web page. It is helpful to scroll the text or image up, down, left, or right. You can put the text or image within the marquee tag which you want to scroll.

Let's see examples: <Marquee> text goes here…. </marquee>

Q17. Why we use 'placeholder' attribute in HTML5?

Placeholder helps the user to easily understand that what can be entered in the field. Placeholder does not take extra space, you can see it inside the input field.


Q18. Explain what is Meta tags?

Provide useful information to our web pages are known as meta tags.

Meta tag includes following:

  • Link- it defines an external source and the relationship between one page to another page.
  • Title- It provides a title to the web page.
  • Style- By using style you can insert CSS details to the web page.

Q19 .What is the use of <figure> tag in HTML5?

This tag is used to add an image in the document of the web page.

Q20. What is the use of output tag in HTML5?

<Output> tag is used to display the different output and result.

Q21. write a code how to Embed Video and Audio in Html5?

<!DOCTYPE html>
<video width = "350" height = "300" controls>
<source src = "MyMovie.mp4" type = "video/mp4">
<!DOCTYPE html>
<audio controls>
<source src = "song.mp3" type = "audio/mpeg">

Q22. List out the page structure elements of HTML5?

  • <nav>: it represents the navigation menu bar in the HTML web page.
  • <header>: It stores the header information of the web page.
  • <section>: It is used to define the structure of the page.
  • <footer>: It is the end section and defines the footer section of the page.
  • <article>: It is a set of information.
  • <aside>: It is used to display side content of the page.

Q23. Explain hyperlink? Does it only apply to text?

Hyperlink is a link that allows the user to move from one page to another by clicking the link. You can apply hyperlink on text as well as images.

<!DOCTYPE html>
<title> Hyperlink </title>
<a href = "https://www.google.com/" target = "_blank">
<img src = "google.png" alt = "google" border = "0/">

Q24.Explain what are the various formatting tags in HTML5?

These are the following formatting tags in HTML5:

  • Small text: To display the small font in web browser, use <small> tags in page.
  • Superscript text: It display the specified text on the top of the text. We can use <sup> tag for superscript text.
  • Subscript text: It display the specified text on the bottom of the text. We can use <sub> tag for subscript text.
  • Marked text: This tag is used to highlight some important text. It provides yellow background to the text.
  • Deleted text: This tag is used to display the deleted text. It provides a thin horizontal in the text. By applying deleted text, use <del> to the text.
  • Emphasized text: To implement emphasized text use tag to the text .This text looks similar to italic text.

Q25. Explain SVG?

SVG stands for Scalable Vector Graphics. It helps to describe two-dimensional vector and raster graphics. SVG images are defined in XML text files. It is mostly used for vector type diagrams like pie charts, 2-Dimensional graphs in an X, Y coordinate system.

<svg width="100" height="100">    
 <circle cx="50" cy="50" r="40" stroke="blue" stroke-width="4" fill="green" />    

Q26. Explain with example what is the use of a span tag?

It displays the text in inline, doesn’t break line. You can use it for adding color, background color, highlight the text in the web browser and also you can use it for adding the icons to your text.

<span style="color: #cccccc ;">  
In this page we use span.  

Q27. What is a style sheet?

Style sheet is an external file for styling the template. It is consistent and transportable. It stored all the styling of the template in one file.

Q28. Explain How to create nested web page in HTML?

Nested represents a webpage within a webpage. For nesting the web page you can use the <iframe> tag.

<!DOCTYPE html>    
<h2>Nested webpage </h2>    
<iframe src="https://www.phptpoint.com/" height="300" width="400"></iframe>    

No Sidebar ads