Welcome Guest! (App Version 5.16)

websitnero logo name

Block Elements

Overview

  • Block elements take full horizontal width available.
  • Div, Paragraph, Section, Article, Aside, etc. are all Block-Elements.
  • Div and Paragraph are the most commonly used "Block-Elements".

Block Elements in HTML

Block elements are those elements which take full horizontal space on a web page. Their behaviour can be explained as rigid and selfish. For example, even if there is one single word written inside a paragraph, it would still take the full horizontal width & it doesn't matter if 90% of its space is still empty.

Div is often used as a wrapper containing other elements and forming a so called section. (Note: the element of <section> is introduced in HTML5, but before that div used to carry out this functionality for decades.)

Example

<body>
  <div>This is div1 .</div>
  <p>This is paragraph1.</p>
  <div>This is div2.</div>
  <p>This is paragraph2.</p>
</body>

Output:

This is div1 .

This is paragraph1.

This is div2.

This is paragraph2.

Further Reading

1. Block-level elements

WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.