Within HTML, you’ve encountered various tags, each of which possesses a default display value, contingent upon its element type. Essentially, HTML elements conform to two fundamental display categories: (a) Block and (b) Inline. This article will delve into the details of block and inline elements in HTML.
What is Block elements in HTML?
Block-level elements are those that typically start a new line on a webpage and take up the full available width by default. Also, Browser adds a margin to its border.
For eg – < div> , < p>, etc.
< h2>This is to check the block Elements
< div>
< p>This is a paragrah-1 inside div1
< /div>
Here the < div> tag is a block-level element that is used to group together other HTML elements and create a container that can be styled. Also, here both < p> and < h2> also act as block elements.
Output:
