似乎无法让我的文本在每个圆圈内对齐中心和垂直。尝试将 h1 文本放入另一个 div - 显示表中,但在每个圆形类中包含文本时遇到问题。
这是我的代码笔和示例代码?
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;
}
http://codepen.io/matriplett/pen/LJcnE http://codepen.io/matriplett/pen/LJcnE
添加包装器div
在你周围h1
<div class="circle1 transparent_class">
<div class="wrapper"><h1>Two lines <br />&Two lines</h1>
</div>
</div>
并像这样改变样式:
.wrapper{
margin-top:40%;
height:100%;
width:100%;
display: table;
}
请参阅此处以获取更新的笔。http://codepen.io/anon/pen/yugBK http://codepen.io/anon/pen/yugBK
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)