Block-level And Inline Elements

Arun kumarArun kumar
2 min read

In this article we will talk about Block level and Inline Elements and what is the difference between them.

Block Element

  • A block-level element always begins on a new line, and browsers add a margin (a space) before and after the element by default.

  • A block-level element always occupies the entire available width (stretches out to the left and right as far as possible).

  • <p> and <div> are two often used block components.

  • HTML (HyperText Markup Language) elements historically were categorized as either "block-level" elements or "inline-level" elements. Since this is a presentational characteristic it is nowadays specified by CSS in the Flow Layout. A Block-level element occupies the entire horizontal space of its parent element (container), and vertical space is equal to the height of its contents, thereby creating a "block".

  • Note: A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can).

Elements

  1. <address>

  2. <article>

  3. <aside>

  4. <blockquote>

  5. <canvas>

  6. <dd>

  7. <div>

  8. <dl>

  9. <dt>

  10. <fieldset>

  11. <figcaption>

  12. <figure>

  13. <footer>

  14. <form>

  15. <h1>-<h6>

  16. <header>

  17. <hr>

  18. <li>

  19. <main>

  20. <nav>

  21. <noscript>

  22. <ol>

  23. <p>

  24. <pre>

  25. <section>

  26. <table>

  27. <tfoot>

  28. <ul>

  29. <video>

    Inline Element

    **Note:** An inline element cannot contain a block-level element!
0
Subscribe to my newsletter

Read articles from Arun kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Arun kumar
Arun kumar