Block and Inline elements...

Photo by Andrew Neel on Unsplash

Block and Inline elements...

Block and inline are the two ways to represent anything on the webpage. So let us understand how they work.

Let us start with block elements these elements are those elements that occupy the space of the whole line. This means if we use a tag that is Block in nature even if we write a single word inside that the control will move to the next line for the next tags or elements means it occupies the complete width. It always begins with a new line <div> is the most popular block component.

Inline these only occupy that much width on a web page as much as their size means two inline elements can be placed side by side naturally. <span> is the most famous inline component.

One should have at least this much knowledge about these two tags as they are often asked in interviews. So I hope you all might have understood this.

Thanks for reading, Have a nice day.