DEV Community

swetha palani
swetha palani

Posted on • Edited on

day 1 plan medium level question

  1. Q: What are self-closing tags in HTML?
    A: Tags that do not have a separate closing tag, used for elements without content.
    Examples: img, br, hr, input, meta

  2. Q: Difference between HTML Tags and HTML Elements
    A:

  • Tag: Code in < >, e.g.,

    or

  • Element: Complete structure with start tag, content, and end tag, e.g.,

    Hello

  1. Q: Difference between id and class attributes A:
  • id: Unique, identifies one element, e.g.,
  • class: Can be used for many elements, e.g.,

  1. Q: Difference between , , A:
  • – Thematic section, e.g.,

    About

  • – Standalone content, e.g.,

    Blog

  • – Sidebar/related content, e.g.,

    Links

  1. Q: Purpose of tag A: Provides metadata about the page, placed in . Examples:
 <meta charset="UTF-8">, <meta name="viewport" content="width=device-width, initial-scale=1.0">
Enter fullscreen mode Exit fullscreen mode
  1. Q: Explain this HTML code:
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body></body>
</html>
Enter fullscreen mode Exit fullscreen mode

A:

  • !DOCTYPE html – HTML5 declaration
  • html lang="en" – Root element with language English
  • head– Metadata section
  • meta charset="UTF-8" – Character encoding
  • meta name="viewport" – Mobile responsive
  • title – Browser tab title
  • body – Visible content section
  1. Q: Difference between ,

    ,

    A:
Tag Location Purpose Visible on Page?
<title> Inside <head> Sets the page title (shown in browser tab & search engines) ❌ No
<h1> Inside <body> Defines the main heading of the webpage ✅ Yes
<header> Inside <body> Groups header content (logo, nav, h1, etc.) ✅ Yes

Top comments (0)