Q: What is HTML and why is it used?
What: HTML (HyperText Markup Language) is a markup language used to create and structure web pages on the internet.
Why: It is used to display text, images, links, and multimedia on web pages, giving structure to websites.
Q: Difference between HTML and HTML5
HTML: Older version to structure web pages, no direct support for audio/video/canvas, uses long doctype, only cookies for storage.
HTML5: Latest version, supports audio, video, canvas, SVG, APIs, simple doctype (<!DOCTYPE html>), local & session storage, mobile-friendly.
Q: What is the purpose of <!DOCTYPE html>?
It tells the browser which HTML version is used and ensures the page renders in standards mode.
Q: Difference between and
| Feature | ||
|---|---|---|
| Purpose | Meta-information about the page | Visible content of the page |
| Content | Title, meta tags, CSS/JS links | Text, images, videos, links, buttons, forms |
| Displayed | Not visible | Visible |
Simple:
stores metadata, shows the content.Q: What are semantic tags?
Semantic tags clearly describe the meaning of the content to browsers and developers.
Examples: , , , , ,
Simple: Semantic tags describe webpage content, e.g., , .
Q: Difference between inline and block-level elements
| Feature | Inline | Block-level |
|---|---|---|
| Display | Flows within a line | Starts on new line, full width |
| Width & Height | Cannot set | Can set |
| Examples | , , | , , |
Simple: Inline stays in line, block starts new line and can have width/height.
Q: Difference between and
| Feature | ||
|---|---|---|
| Type | Block-level | Inline |
| Usage | Group sections of content | Style small text/content |
| Line Behavior | Starts new line, full width | Stays in line |
| Example | Text |
This is highlighted |
Simple:
groups blocks, styles text.Q: What are HTML attributes?
Attributes give extra info about elements in name="value" format.
Examples: id, class, src, href, alt
Simple: Attributes give info about elements, e.g., id, class, src.
Q: Difference between
- ,
- , and
| Feature | |||
|---|---|---|---|
| Purpose | Numbered list | Bulleted list | Terms & definitions |
| Numbering/Bullets | 1,2,3… | • | None ( |
| Example |
|
|
|
Simple:
- numbered,
- bulleted,
- definitions.
Q: Difference between Absolute URL and Relative URL in tag
| Feature | Absolute URL | Relative URL |
|---|---|---|
| Definition | Full address including domain | Path relative to current page |
| Example | Link | Link |
| Usage | Link to other websites | Link within same site |
Simple: Absolute = full address, Relative = path from current page.
Q: What are self-closing tags in HTML?
Self-closing tags don’t need a closing tag; used for elements without content.
Examples: img, br, hr, input, meta
Top comments (0)