Intermediate HTML Interview Questions & Answers

  1. What is the difference between <section>, <article>, and <aside>?

    • <section> groups related content, <article> is for self-contained pieces like blogs, <aside> is for side content like ads or links.
  2. What is the use of the <meta> tag?

    • Provides metadata about the HTML document, like charset, author, and viewport settings for responsiveness.
  3. What is the purpose of the alt attribute in images?

    • Describes the image for screen readers and is shown when the image fails to load.
  4. How can you embed audio and video in HTML5?

    • Use <audio> and <video> tags. Example:

        <video controls><source src="movie.mp4" type="video/mp4"></video>
        <audio controls><source src="sound.mp3" type="audio/mpeg"></audio>
      
  5. How do you create a hyperlink that opens in a new tab?

    • Use target="_blank" in the anchor tag: <a href="url" target="_blank">Link</a>
  6. What are global attributes in HTML?

    • Attributes that can be used on any HTML element. Examples: id, class, style, title, data-*.
  7. What is the difference between <strong> and <b>? Or <em> and <i>?

    • <strong> and <em> have semantic meaning (important/emphasized), while <b> and <i> are just visual (bold/italic).
  8. How do forms work in HTML? What elements are involved?

    • Forms collect user input. Main elements: <form>, <input>, <textarea>, <button>, <select>, <label>.
  9. What is the purpose of the name attribute in form elements?

    • It identifies form data when it is submitted to the server.
  10. What is the difference between localStorage, sessionStorage, and cookies?

    • localStorage: Stores data with no expiration.

    • sessionStorage: Stores data until the tab is closed.

    • cookies: Can store small data with optional expiration, sent with each HTTP request.

0
Subscribe to my newsletter

Read articles from Banashree Aribenchi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Banashree Aribenchi
Banashree Aribenchi