我想弄清楚如何将div中的绝对span元素居中。你有什么建议吗?代码如下。我需要的东西也是反应灵敏的东西。就像放大和缩小一样,跨度保持在div元素的中心。左:50%没有帮助。
HTML:
<div class="modal_cloud">
<span class="modal_cloud_title">
GPS Trackers Shop
</span>
<img src="images/ios.png" class="modal_responsive_image"> <img src="images/android.png" class="modal_responsive_image"> <img src="images/windows_phone.png" class="modal_responsive_image">
</div>
CSS:
.modal_cloud {
position: relative;
float: right;
background-color: #ffffff;
width: 32%;
height: 52%;
margin: 40px auto;
border-radius: 6px;
border: 1px #d9d9d9 solid;
}
.modal_cloud_title {
position: absolute;
display: table;
border-radius: 6px;
background-color: #FFF;
border: 1px #d9d9d9 solid;
left: 0;
right: 0;
margin: -8px auto;
}
*这个变化不大:*
position: absolute;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;