HTML FAQ

Q1 — What is HTML?

HTML (HyperText Markup Language) is the standard language for creating web pages. It uses elements (tags) to describe the structure and meaning of content.

<!DOCTYPE html>
<html>
<head>
<title>Page</title>
</head>
<body>
<h1>Hello</h1>
<p>Paragraph text.</p>
</body>
</html>

Q2 — Difference between HTML, XHTML, and HTML5?

HTML: Original, forgiving syntax.

XHTML: XML-based, strict rules (must be well-formed).

HTML5: Modern spec with semantic tags, multimedia APIs, canvas, storage, and more.

Q3 — What are tags and attributes?

Tags are element names wrapped in <> (e.g., <p>). Attributes provide extra information (e.g., class, id, src).

<img src="cat.jpg" alt="Cute cat">

Q4 — Block-level vs Inline elements?

Block-level elements (e.g., <div>, <p>) take full width and start on a new line. Inline elements (e.g., <span>, <a>) flow within a line.

Q5 — Difference between <div> and <span>?

<div> is block-level (layout container). <span> is inline (wrap small bits of content).

Q6 — Semantic HTML: what and why?

Semantic elements (like <article>, <nav>, <header>) express meaning — improving accessibility, SEO, and maintainability.

Q7 — <strong> vs <b>?

<strong> indicates importance (semantic). <b> is presentational (bold) without semantic emphasis.

Q8 — <em> vs <i>?

<em> indicates emphasis (semantic). <i> is typically for italics/presentation or alternate voice.

Q9 — Void/self-closing elements?

Elements that don't have content or closing tags: <img>, <br>, <hr>, <input>, <meta>, <link>.

Q10 — Difference between HTML and CSS?

HTML defines structure and content; CSS defines presentation (layout, colors, fonts).

⬅ Home