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, metaQ: 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
- Q: Difference between id and class attributes A:
- id: Unique, identifies one element, e.g.,
- class: Can be used for many elements, e.g.,
- Q: Difference between , , A:
- – Thematic section, e.g.,
About
- – Standalone content, e.g.,
Blog
- – Sidebar/related content, e.g.,
Links
-
Q: Purpose of tag
. Examples: ,
A: Provides metadata about the page, placed in Q: Explain this HTML code:
html
<!DOCTYPE html>
Document
A:
- <!DOCTYPE html> – HTML5 declaration
- – Root element with language English
- – Metadata section
- – Character encoding
- – Mobile responsive
- – Browser tab title
- – Visible content section
-
Q: Difference between ,
,
A:
- – Page title in browser tab
– Main heading of page
- – Top section of page, can contain headings/nav
Top comments (0)