I have one div of class 'outerpiccontainer' which contains another div 'pic container' inside of it. The inner div is currently empty and just has some styling applied to it, it is 80% height and width of the outer div.
Currently I am able to center the inner div by using a left margin of 10% (10+10+80 =100). However I am not happy with this solution (if I change the size ratio between divs I will lose my center). Is there a way or property to center a div within a div?
Thanks in advance! I have the html portion followed by css below.
<section class="outerpiccontainer">
<p>Place photo here</p>
<div class="piccontainer"></div>
</section>
.outerpiccontainer
{
background-color:#BF1432;
width:38%;
height:400px;
padding:1%;
border-top:5px inset #DCDCDC;
border-bottom:5px inset #DCDCDC;
border-bottom-left-radius: 8%;
float:left
}
.piccontainer
{
background-color:#DCDCDC;
width:80%;
height:80%;
padding:1%;
border-radius: 50%;
-moz-box-shadow: 10px 10px 5px black;
-webkit-box-shadow: 10px 10px 5px black;
box-shadow: 10px 10px 5px black;
margin-left: 10%;
float:left;
}