I'm struggling to align my text center and vertically within each circle. I attempted putting the h1 text inside another div with display table, but I am facing issues in containing the text within each circle class. Would you mind taking a look at my example code on CodePen?
HTML:
<div id="circle-wrapper">
<div class="circle1 transparent_class"><h1>Two lines <br />&Two lines</h1></div>
<div class="circle2 transparent_class"><h1>Two lines<br /> Two lines</h1></div>
<div class="circle3 transparent_class"><h1>Two lines<br />& Two lines</h1></div>
<div class="circle4 transparent_class "><h1>Two lines<br /> Two lines</h1></div>
</div><!--close of circle-wrapper-->
CSS:
#circle-wrapper{
position:relative;
top:0;
left:0;
}
.circle1, .circle2, .circle3, .circle4 {
position:absolute;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
width: 32%;
height: 32%;
padding-bottom: 32%;
}
h1.circle1 h1 {
display:inline-block;
display: table-cell;
vertical-align: middle;
text-align: center;
}
.circle1 {
background-color:#889fbe;
color:000;
margin-top:-8%;
left:10%;
}
.circle2 {
margin-top:10%;
color:000;
left:24%;
background-color:#b1daf6;
}
.circle3 {
margin-top:24%;
left:10%;
background-color:#4f4f51;
}
.circle4 {
margin-top:10%;
left:-8%;
background-color:#56a0d3;
}
.transparent_class {
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
/* IE 5-7 */
filter: alpha(opacity=70);
/* Netscape */
-moz-opacity: 0.7;
/* Safari 1.x */
-khtml-opacity: 0.7;
/* Good browsers */
opacity: 0.7;
}