CSS Interview Question And Answer

what is HTML5

HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.

Name some of the new features of HTML5.

HTML5 introduces a number of new elements and attributes that helps in building a modern websites. Following are great features introduced in HTML5 -

  • New Semantic Elements - These are like <header>, <footer>, and <section>.
  • Forms 2.0 - Improvements to HTML web forms where new attributes have been
    introduced for <input> tag.
  • Persistent Local Storage - To achieve without resorting to third-party plugins.
  • WebSocket - A a next-generation bidirectional communication technology for web
    applications.
  • Server-Sent Events - HTML5 introduces events which flow from web server to the web
    browsers and they are called Server-Sent Events (SSE).
  • Canvas - This supports a two-dimensional drawing surface that you can program with
    JavaScript.
  • Audio & Video - You can embed audio or video on your web pages without resorting to
    third-party plugins.
  • Geolocation - Now visitors can choose to share their physical location with your web
    application.
  • Microdata - This lets you create your own vocabularies beyond HTML5 and extend your
    web pages with custom semantics.
  • Drag and drop - Drag and drop the items from one location to another location on a the
    same webpage.
What is the purpose of 'section' tag in HTML5?

This tag represents a generic document or application section. It can be used together with h1-
h6 to indicate the document structure.

What were some of the key goals and motivations for the HTML5 specification?

HTML5 was designed to replace both HTML 4, XHTML, and the HTML DOM Level 2.
Major goals of the HTML specification were to:

  • Deliver rich content (graphics, movies, etc.) without the need for additional plugins (e.g.,
    Flash).
  • Provide better semantic support for web page structure through the introduction of
    new structural element tags.
  • Provide a stricter parsing standard to simplify error handling, ensure more consistent
    cross-browser behavior, and simplify backward compatibility with documents written to
    older standards.
  • Provide better cross-platform support (i.e., to work well whether running on a PC,
    Tablet, or Smartphone).
Difference between HTML and XHTML

XHTML is the reformulation of HTML 4 as an application of XML. XHTML 1.0 [XHTML1] specifies
three XML document types that correspond to the three HTML 4 DTDs: Strict, Transitional, and
Frameset. XHTML 1.0 is the basis for a family of document types that subset and extend HTML.

What are doctypes

The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about
what version of HTML the page is written in.
In HTML 4.01, the <!DOCTYPE> declaration refers to a DTD, because HTML 4.01 was based on
SGML. The DTD specifies the rules for the markup language, so that the browsers render the
content correctly.
HTML5 is not based on SGML, and therefore does not require a reference to a DTD.