Block Display

You may have noticed that some elements like headings and paragraphs automatically create a new line. This is because they have a block display.

Block elements create a new line and are as wide as their parent. We can also change the width and height of block elements.

Examples of block elements:

  • Headings (h1 to h6)
  • Paragraphs (p)
  • Container element (div)

We can change non-block elements to block elements.

Example of changing elements with italic style (em) to block:

em {
	display: block;
}

Instructions

We can see that the strong element is not block-level as it is not on its own line.

Change the display property of the strong element to block-level (block).

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

2/10

Block Display | Start Coder