Html Qna

SAMBHAV JAINSAMBHAV JAIN
2 min read
  • Q1: What is the purpose of the declaration?

    A1: The declaration is the very first thing in an HTML document. It tells the browser that the page is written in HTML5. This ensures the browser renders the page correctly according to the latest web standards.

  • Q2: Explain the role of the and tags.

    A2:The section contains meta-information about the HTML document that isn't displayed on the page itself. In the example file, this includes the character set (), viewport settings for responsive design (<meta name="viewport"...>), the page title (), and the link to the external CSS stylesheet (<link rel="stylesheet"...>).

    The section contains all the visible content of the web page, such as headings, buttons, input fields, and other elements the user sees and interacts with.

  • Q3: What is the difference between an id and a class attribute?

    A3: Both are used to identify elements, but they have a crucial difference:

    An id must be unique to a single element on a page. It's used for specific element identification, often for JavaScript hooks.

    Example:

    uniquely identifies the container for the setup screen.

    A class can be applied to multiple elements. It is primarily used for applying the same CSS styles to a group of elements.

    Example:

    is used for all nine cells on the board, allowing them to share the same styling.

  • Q4: What are data-* attributes, like data-cell seen in the grid cells?

    A4: data-* attributes are a standard way to store custom data private to the page or application. They are used by JavaScript to attach extra information (like a cell's position) to an element without misusing standard attributes.

  • Q5: In the tags, what is the purpose of the type attribute?

    A5: The type attribute specifies the kind of input control to be displayed. In the file, creates a standard text field for the player's name. Other common types include password, number, checkbox, radio, and submit.

0
Subscribe to my newsletter

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

Written by

SAMBHAV JAIN
SAMBHAV JAIN