HTML – Blocks
In HTML, a block is a structural element that helps organize and group content on a web page. Blocks are used to define different sections, such as paragraphs, headings, lists, and divisions, which can be styled and manipulated with CSS (Cascading Style Sheets).
Here are some commonly used HTML block-level elements:
1.<div>
: The <div>
element is a generic block-level container that does not have any semantic meaning. It is often used to group and style other elements or sections of content.
Example:
1 2 3 4 5 |
<div> <h1>Welcome to my website</h1> <p>This is a sample paragraph.</p> </div> |
2.<p>
: The <p>
the element represents a paragraph of text.
Example:
1 2 |
<p>This is a paragraph.</p> |
<h1>
to <h6>
: These elements represent headings of different levels, with <h1>
being the highest (most important) and <h6>
being the lowest (least important)
Example:
1 2 |
<h1>Main Heading</h1> <h2>Subheading</h2> |
4. <ul>
and <ol>
: The <ul>
element represents an unordered list, while the <ol>
element represents an ordered (numbered) list. Each list item is defined using the <li>
element.
Example:
1 2 3 4 5 6 7 8 9 |
<ul> <li>Item 1</li> <li>Item 2</li> </ul> <ol> <li>Item 1</li> <li>Item 2</li> </ol> |
5. <blockquote>
: The <blockquote>
element is used to indicate a block of quoted content.
Example:
1 2 3 |
<blockquote> <p>This is a quoted text.</p> </blockquote> |