HTML & CSS Course
HTML & CSS
/
Beginner

Paragraphs

Definition

The `<p>` element represents a paragraph of text. Browsers automatically add an empty line (margin) before and after each `<p>` element.

Explain Like I'm New

The bread and butter of text on the web. Any standard block of reading text should be wrapped in a `<p>` tag.

Real World Example

Writing a blog post. Every separate block of text is its own `<p>` tag.

Common Use Cases

  • •Displaying standard text
  • •Separating blocks of reading material

Interactive Example

Interview Questions

basic

  • Is the `<p>` tag a block-level or inline element?

intermediate

  • What happens if you put a bunch of extra spaces and line breaks inside a `<p>` tag in your code?

Flash Cards

Question

Block or inline?

Click to reveal answer
Answer

Block-level. It always starts on a new line and takes up the full width.

Question

Extra spaces?

Click to reveal answer
Answer

Browsers ignore them! This is called 'whitespace collapse'. Even if you press 'Enter' 10 times inside a paragraph in your HTML file, the browser will render it as a single space. You must use the `<br>` tag to force a line break.