Center Multiple DIVs with CSS

Center Multiple Divs with CSSAt some point, you may have a situation where you want to center multiple elements (maybe <div> elements, or other block elements) on a single line in a fixed-width area. Centering a single element in a fixed area is easy. Just add margin: auto and a fixed width to the element you want to center, and the margins will force the element to center.

There really should be a similar simple way to center multiple elements evenly spaced. It would be nice if CSS had a property called “box-align” which you could set to “center” then the child elements would be centered evenly within their parent.

Well, you can achieve something similar by taking advantage of CSS’s flexibity with “recasting” elements (for lack of a better term).



This post was generated by an RSS Feed from Impressive Webs

You may also like to read:

If you enjoyed this post, make sure you subscribe to my RSS feed!
Print
SocialTwist Tell-a-Friend
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Get your own free independent review service!
Category: Web Tutorials

You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply

You must be logged in to post a comment.

Close [X]