jQuery Mobile框架是否有一种集中元素的方式,特别是按钮?看起来它默认为左对齐所有内容,我无法找到一种方法(在框架内)来做到这一点.
nau*_*tur 76
jQuery Mobile似乎没有css类来居中元素(我通过它的css搜索).
但是你可以自己编写额外的CSS.
尝试创建自己的:
.center-button{
margin: 0 auto;
}
Run Code Online (Sandbox Code Playgroud)
示例HTML:
<div data-role="button" class="center-button">button text</div>
Run Code Online (Sandbox Code Playgroud)
看看会发生什么.您可能需要在换行标记中将text-align设置为居中,这样可能会更好:
.center-wrapper{
text-align: center;
}
.center-wrapper * {
margin: 0 auto;
}
Run Code Online (Sandbox Code Playgroud)
示例HTML:
<div class="center-wrapper">
<div data-role="button">button text</div>
</div>
Run Code Online (Sandbox Code Playgroud)
小智 14
一种矫枉过正的方法:在div中的内联css做了诀窍:
style="margin:0 auto;
margin-left:auto;
margin-right:auto;
align:center;
text-align:center;"
Run Code Online (Sandbox Code Playgroud)
中心就像一个魅力!
| 归档时间: |
|
| 查看次数: |
102291 次 |
| 最近记录: |