gpt4 book ai didi

jquery - 在Jquery Mobile中如何使多div到页面中心

转载 作者:行者123 更新时间:2023-11-28 18:32:46 25 4
gpt4 key购买 nike

enter image description here

现在我正在将它放在页面的左侧,我想将它放在页面的中央。

HTML:

<div id="viewMe">       
<div class="leftelement">
<div class="leftelement Width150">
<a href="page1.html">
<span class="image1">&#32;</span>
<span>Image 1</span>
</a>
</div>
<div class="leftelement Width150">
<a href="page2.html">
<span class="image2">&#32;</span>
<span>Image 2</span>
</a>
</div>
<div class="leftelement Width150">
<a href="page3.html">
<span class="image3">&#32;</span>
<span>Image 3</span>
</a>
</div>
</div>
</div>

CSS:

.leftelement{float:left;}
.Width150 {width:150px;}
.image1 {background: url(../images/image1.png) no-repeat;height: 160px;width: 145px;display:block;}
.image2 {background: url(../images/image2.png) no-repeat;height: 160px;width: 145px;display:block;}
.image3 {background: url(../images/image3.png) no-repeat;height: 160px;width: 145px;display:block;}

最佳答案

我认为这就是您要找的,结合使用 css 调整,我已经修改了您的代码,因此元素 float 在中心,而不需要对包含的 div 应用宽度

    text-align:center;
display:inline-block;

http://jsfiddle.net/BSPVM/1/

关于jquery - 在Jquery Mobile中如何使多div到页面中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13817860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com