Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does inline-block mean for css?

Tags:

html

css

Can someone explain the difference between 'block' and 'inline-block' for the CSS display setting?

like image 301
John Livermore Avatar asked Feb 10 '12 00:02

John Livermore


2 Answers

Basically, it’s a way to make elements inline, but preserving their block capabilities such as setting width and height, top and bottom margins and paddings etc. For example:

Inline-block demo

(Source: http://www.impressivewebs.com/inline-block/)

like image 153
Rodney Folz Avatar answered Oct 09 '22 21:10

Rodney Folz


inline-block treats the element like other inline elements but allows the use of block properties.

Elements with display: block take up as much width as they are allowed and typically start on a new line.

like image 42
Coronus Avatar answered Oct 09 '22 19:10

Coronus