what is the diffeernce between inline and inline-block and also difference b/w inline-block and block.
hi @kolleparatejaswini97 . basically in block we cannot change the amount of space the element occupies, block elements occupy the whole block,so the element is printed on new line. example: header tags.
inline elements only occupy the space which is required for them, example : img tag.
inline-block is a combination of above two, it allows you to change the dimensions of the element.
hi @kolleparatejaswini97 display: inline-block brought a new way to create side by side boxes that collapse and wrap properly depending on the available space in the containing element. It makes layouts that were previously accomplished with floats easier to create. No need to clear floats anymore.
Compared to display: inline, the major difference is that inline-block allows to set a width and height on the element. Also, with display: inline, top and bottom margins & paddings are not respected, and with display: inline-block they are.
Now, the difference between display: inline-block and display: block is that, with display: block, a line break happens after the element, so a block element doesn’t sit next to other elements.