Loading

Elements in HTML and CSS

In HTML and CSS, elements are categorized into two main types: 

  • Block-level elements
  • Inline elements

Block-level Elements

  • Block-level elements create a block formatting context, meaning they start on a new line and take up the full width available by default.
  • They stack vertically on each other, forming distinct blocks of content. 
  • Block-level elements are commonly used for structural divisions and significant sections of a web page.

Example:

<!DOCTYPE html>
<html>

<head>
    <title>Element</title>
</head>

<body>
    <h3>Block-Level Element example</h3>
    <div>
        <h1>Heading 1</h1>
        <p>This is a paragraph.</p>
        <ul>
            <li>Item 1</li>
            <li>Item 2</li>
        </ul>
    </div>
</body>

</html>