Block and Inline Elements of HTML

Block and Inline elements

Here are the two unique elements of HTML that are widely used.

  1. Block Elements

Block elements start from a new line and occupy enough space compared to the normal text. The browser automatically recognizes these elements and adds spaces.

Think of a block element as a building block on a page. It always takes up the full width it can, spreading out as far as possible.






Two common types of block elements are:

  • Paragraph <p>: This is for regular text. Each <p> tag starts a new line and goes all the way across the page.
  • Division <div>: This is a more general container. You can use it to group other elements together and style them as a unit.

So, basically, block elements stack vertically on a page and fill the entire width available.

Here is a list of all the Block Elements of HTML:

Block elements of HTML


  2. Inline elements

The elements that take up the required space and don't start with a new line are the Inline Elements.

It only takes the necessary width.

For instance: <span>Inline Element<span> (span element) is an Inline element.





     Here is a list of Inline elements of HTML:

Inline Elements of HTML

                                                                                                                                                                                                          

Comments

Popular posts from this blog

Basics of HTML- Learn web dev online

CSS - Introduction