Center A Container Ul/div In A Fluid Layout
I want to center a container div in a fluid lay-out (content with id: articles_grid has to be centered): http://www.benskesblog.com/projects/frontend/project/index.htm I've tried a
Solution 1:
I believe changes are pretty simple to achieve what you need:
#articles_grid {
...
text-align: center; /*add this*/
}
#articles_gridli {
...
/* float:left; remove this */display: inline-block; /*add this*/
}
Solution 2:
You can give display:inline-block
to you DIV
which you want in center & define text-align:center in his parent DIV
. For example you can do like this:
CSS:
.parent{
background:red;
text-align:center;
}
.center{
text-align:left;
display:inline-block;
*display:inline;/* IE7 */
*zoom:1;
background:yellow;
min-height:100px;
}
HTML:
<divclass="parent"><divclass="center">lorem ipsum</div></div>
Check the example below:
Post a Comment for "Center A Container Ul/div In A Fluid Layout"