HTML Block-Level and Inline Elements

HTML Block-Level and Inline Elements

An HTML Block-Level Element is an element that creates a horizontal boundary block.

It always starts on a new line and takes the full width available.

Here is a list of commonly used block-level elements.

  • <h1 - <h6> element
  • <p> element
  • <div> element

Example:

<!doctype html>
<html>
    <head>
        <title> HTML Inline Element </title>
    </head>
    <body>
        <h1>Block Level elements </h1>
        <p>always start</p>
        <div>in a new line</div>
    </body>
</html>

Output:

HTML Inline Elements

An HTML Inline Element is an element that does not create its own horizontal boundary block.

It does not start on a new line.

Here is a list of commonly used inline elements.


  • <span> element
  • <a> element
  • <img> element

Example:

<!doctype html>
<html>
    <head>
        <title> HTML Inline Element </title>
    </head>
    <body>
        <span>Inline elements</span>
        <a href="#">don't start in a new line.</a>
        <img src="star.svg" />
    </body>
</html>

Output:

✔️There will be more HTML Block-Level and Inline Elements example in the next tutorial.
    
                                                                                

Post a Comment

Post a Comment (0)