2012-07-05

The difference between float and display:inline-block

When you use float, the elements will follow you (i.e. if you float:left an element, the elements after it will follow you to the right. If you float:right an element, the elements after it will follow you to the left.). As the name suggests, the element will float in your web page as much as it can (either to left or to right, as you define). If you use float property, it can overlap with other elements on your webpage. But when you set the display:inline-block, it would not make an element overlap with others.

Since the floating elements float either to left or right, it's bit hard to deal with aligning a floated element to the center.

No comments: