user429620
user429620

Reputation:

center contents of float:left

I want to center the contents of a div that is floated to the left, (incidentally, the contents of this div is other containers that are floated to the left)

See http://jsfiddle.net/KgH8c/ for an example.

I cannot use inline-block due to that not working in IE.

Are there any other solutions?

Thanks, Wesley

Upvotes: 2

Views: 175

Answers (1)

thirtydot
thirtydot

Reputation: 228282

I cannot use inline-block due to that not working in IE.

That's not entirely true. It works completely in IE8 and greater. In IE6/7, it only works on naturally inline elements. Fortunately, there's a really easy way to fix it (to work on for example, divs):

.inline-block {
    display: inline-block;
    *display: inline;
    zoom: 1
}

See: http://jsfiddle.net/thirtydot/KgH8c/1/

Upvotes: 3

Related Questions