Home › HTML Tutorial › Block, inline and div
Block, inline and div
How elements flow on the page.
Block elements (div, p, h1) start a new line and fill the width. Inline elements (span, a) sit within text. div and span are neutral containers for styling.
Commands in this lesson
p
Definition: Defines a paragraph of text.
Syntax:
<p>Text</p>
Example:
<p>Hello, web!</p>h1
Definition: Defines the main heading of the page. Use one per page.
Syntax:
<h1>Heading text</h1>
Example:
<h1>Welcome</h1>a
Definition: Creates a hyperlink to another page or resource.
Syntax:
<a href="URL">link text</a>
Example:
<a href="https://example.com">Visit</a>Example code
<div style='background:#cde'>Block div</div>
<p>Text with <span style='color:red'>an inline span</span>.</p>'