I've looked for the answer here and tried everything, but I can't find a solution that works for my case. So I've decided to ask:
I want to center horizontally the div "listapost" (contained in the div "heart", width 100%). "Listapost" contains a certain number of "post" divs, 2 or 3 per rows according to the total width of the screen. This is the css:
#heart{width:100%}
#post{
width:50px;
float:left;
text-align:left;
padding:5px;
margin:1px;
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
color:#605f5f;
background-color:#f7f6f6;
}
#listapost{margin:0 auto;}
the HTML is something like this:
<div id="heart">
<div id="listapost">
<div id="post">stuff</div>
<div id="post">stuff</div>
<div id="post">stuff</div>
....
</div>
</div>
Even using "display: inline-block" and removing the float property of "post" the "listapost" div is not centered. Why?