HTML interview questions

HTML quiz questions

  • 1.

    What are the new <input> types for form validation in HTML5?

    Answer:

    The new input types for form validation are email, url, number, tel and date.

    Example:

    <input type="email">

     

    View
  • 2.

    What is the use of required attribute in HTML5?

    Answer:

    It forces user to fill text on textfield or textarea before submitting form. It is used for form validation.

    Example:

    Name: <input type="text" name="name" required>

     

    View
  • 3.

    If I do not put <!DOCTYPE html> will HTML 5 work?

    Answer:

    No, browser will not be able to identify that it is a HTML document and HTML 5 tags will not function properly.

    View
  • 4.

    How tags are migrated from HTML4 to HTML5?

    Answer:

    No. Typical HTML4 Typical HTML5
    1) <div id="header"> <header>
    2) <div id="menu"> <nav>
    3) <div id="content"> <section>
    4) <div id="post"> <article>
    5) <div id="footer"> <footer>

    Header and Footer Example

    HTML 4 Header and Footer:

    <div id="header">  
      <h1>Monday Times</h1>  
    </div>  
    .  
    .  
    .  
    <div id="footer">  
      <p>© JavaTpoint. All rights reserved.</p>  
    </div>

    HTML 5 Header and Footer:

    <header>  
      <h1>Monday Times</h1>  
    </header>  
    .  
    .  
    .  
    <footer>  
      <p>© JavaTpoint. All rights reserved.</p>  
    </footer>

    Menu Example

    HTML 4 Menu:

    <div id="menu">  
      <ul>  
        <li>News</li>  
        <li>Sports</li>  
        <li>Weather</li>  
      </ul>  
    </div>

    HTML 5 Menu:

    <nav>  
      <ul>  
        <li>News</li>  
        <li>Sports</li>  
        <li>Weather</li>  
      </ul>  
    </nav>

     

    View
  • 5.

    What is datalist tag?

    Answer:

    The HTML 5 datalist tag provides an auto complete feature on form element. It facilitates users to choose the predefined options.

    View
  • 6.

    What does details and summary tag?

    Answer:

    The details tag is used to specify some additional details on the web page. It can be viewed or hidden on demand. The summary tag is used with details tag.

    View
  • 7.

    What is button tag?

    Answer:

    The button tag is used in HTML 5. It is used to create a clickable button within HTML form on the web page. It is generally used to create a "submit" or "reset" button.

    View
  • 8.

    What is the use of figure tag in HTML 5?

    Answer:

    The figure tag is used to add a photo in the document on the web page.

    View
  • 9.

    What is the difference between progress and meter tag?

    Answer:

    The progress tag is used to represent the progress of the task only while the meter tag is used to measure data within a given range.

    View
  • 10.

    Is audio tag supported in HTML 5?

    Answer:

    Yes. It is used to add sound or music files on the web page.

    View
  • 11.

    Which video formats are supported by HTML5?

    Answer:

    HTML 5 supports three types of video format:

    • mp4
    • webm
    • ogg
    View
  • 12.

    Is there any need to change the web browsers to support HTML5?

    Answer:

    No. Almost all browsers (updated versions) support HTML 5. For example: Chrome, Firefox, Opera, Safari, IE etc.

    View
  • 13.

    What are the different new form element types in HTML 5?

    Answer:

    Following is a list of 10 important new elements in HTML 5:

    • Color
    • Date
    • Datetime-local
    • Email
    • Time
    • Url
    • Range
    • Telephone
    • Number
    • Search
    View
  • 14.

    What is SVG?

    Answer:

    HTML SVG is used to describe the two dimensional vector and vector/raster graphics.

    View
  • 15.

    What is canvas in HTML5?

    Answer:

    Canvas is an HTML area which is used to draw graphics.

    View
  • 16.

    What is the use of iframe tag?

    Answer:

    An iframe is used to display a web page within a web page.

    Syntax:

    <iframe src="URL"></iframe>

    Example:

    <iframe src="demo_iframe.html" width="200px" height="200px"></iframe>

    Target to a link:

    <iframe src="http://www.javatpoint.com" name="iframe_a"></iframe>

     

    View
  • 17.

    What is the use of span tag? Give one example.

    Answer:

    The span tag is used for following things:

    • For adding color on text
    • For adding background on text
    • Highlight any color text etc.

    Example:

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

     

    View
  • 18.

    What are empty elements?

    Answer:

    HTML elements with no content are called empty elements. For example: <br>, <hr> etc.

    View
  • 19.

    How to make a picture a background image of a web page?

    Answer:

    To make a picture a background image on a web page, you should put the following tag code after the tag.

    <body background = "image.gif">

    Here, replace the "image.gif" with the name of your image file which you want to display on your web page.

    View
  • 20.

    How many tags can be used to separate section of texts?

    Answer:

    There are three tags used to separate the texts. i.e. usually <br> tag is used to separate line of texts. Other tags are<p> tag and <blockquote> tag.

    View

© 2017 QuizBucket.org