<div class="parent"> <div class="son"></div> </div>
.parent{ width: 200px; height: 200px; background-color: yellow; } .son{ margin: 0 auto; width: auto; height: 100px; background: red; }