Tuesday, 20 August 2013

How to fix Margin Auto when Floating-Left Elements are involved

How to fix Margin Auto when Floating-Left Elements are involved

Have a class for the page, a container class for rows of div-boxes, and
box class to style all of the boxes..
The rows of div-boxes need to be centered on the page..
What combination of width + display + margin is required (cross-browser)?
The boxes are floating-left, which seems to be the origin of the question..
Current CSS:
.page {
width: 100%;
}
.container {
width: 100%;
display: block;
margin: 0 auto;
}
.box {
float: left;
margin: %;
}

No comments:

Post a Comment