I have several div
with float: left
inside another div, which is the container of them, according to code:
<div id="container">
<div id="box-1" class="box">1</div>
<div id="box-2" class="box">2</div>
<div id="box-3" class="box">3</div>
</div>
I'm trying to align them horizontally inside the container (as pictured below), but I'm not getting it.
Well,Icannotmakeitwork.Here'smyCSSandthentheresultI'mgetting.
#container{width:100%;border-color:blue;text-align:center;}.box{float:left;width:100px;height:200px;margin:10px20px;}#box-1{background-color:red;}#box-2{background-color:green;}#box-3{background-color:pink;}
DIVs are not getting aligned like I assumed would happen when using text-align: center
in the container. How to achieve the expected result?