<div class="container"> <div class="ex"></div> </div>
.container{ border:1px solid black; height:100px; } .ex{ background-color:red; height:50px; width:50%; margin:0 auto; }