</> Code Corner

HTML · HTML Tutorial · Lesson 20

HTML Block & Inline

Block-level vs inline elements.

Every HTML element has a default display value: block or inline.

Block-level Elements

A block-level element always starts on a new line and takes up the full width available. Examples: <div>, <p>, <h1>, <ul>, <table>, <form>.

Example

<div style="border: 1px solid black">Hello World</div>
<p style="border: 1px solid red">I take the full width too.</p>

Keep reading “HTML Block & Inline”

Sign up to read the full lesson (4 more parts), try every example in the live editor, and take the 5-question quiz.

Chat with us 👋