gpt4 book ai didi

jquery - 文本对齐 :center not working

转载 作者:太空狗 更新时间:2023-10-29 15:00:58 24 4
gpt4 key购买 nike

我正在使用 jquery mobile 并具有以下 html 和 css:

    .ui-grid-a {
padding: 0;
margin: 0;
margin-top: 15px;
height: 380px;
}
.ui-block-a, .ui-block-b {
padding: 0;
margin: 0;
height: 33.3%;
}
.ui-block-a a, .ui-block-b a {
width: 50%;
}
.ui-bar-a, ui-bar {
margin: 0 auto;
padding: 0;
height: 90%;
width: 90%;
max-width: 500px;
text-align: center;
/* Gradient set-up */
background: #3DC8F3 !important;
/* Border set-up */
border: 0px solid white;
border-radius: 0px;
box-shadow: 0px 0px 0px #000;
display: table;
}
.menu-elem {
margin: 0;
display: table-cell;
vertical-align: middle;
text-align: center !important;
}
.menu-elem a {
text-decoration: none;
}
.menu-elem .menu-text {
margin-top: 5px;
font-size: 0.9em;
color: #FFF;
text-align:center;
}

.ui-bar, .ui-body {
position: relative;
overflow: hidden;
display: block;
padding: 0.9em 1em !important;
clear: both;
text-align: center !important;
}
This is the full css that is being rendered for this block
<div data-role="page" id="AppBody" style="background: #00AEEF"> 
<div data-role="header"style="background:#0E74BC;color:white;">
<h1 class="Home">Home</h1>
<a href="#" data-role="button"data-direction="reverse" onclick="WL.Client.logout('CustomAuthenticatorRealm',{onSuccess: WL.Client.reloadApp})" data-transition="slide"
data-iconpos="notext" class="ui-btn-right"><img src="images/logout.png" style="width: 25px;"></a>
</div>
<div role="main" class="ui-content">
<div class="ui-grid-a"> <!-- menu-container -->
<div class="ui-block-a">
<div class="ui-bar ui-bar-a">
<div class="menu-elem">
<a href="#">
<div class="menu-img">
<img src="images/t.png" style="width: 50px;">
</div>
<div class="menu-text">test</div>
</a>
</div>
</div>
</div>
</div>
</div>
</div>

text-align: -moz-center; 在 Mozilla 中工作正常,但在其他浏览器中却不行。如果我使用 text-align: center; 那么它在任何浏览器中都不起作用。 this is how I am getting now this is how i want

最佳答案

仅使用 text-align:center; 它适用于所有浏览器。此外,您可以使用 margin: 0 auto; 居中对齐 Demo

.ui-bar, .ui-body {
position: relative;
overflow: hidden;
display: block;
padding: 0.9em 1em !important;
clear: both;
text-align: center;
margin:0 auto;
}

修订 Demo :

在看到您的预期输出后,我发现这是解决方案之一。

.ui-grid-a {
padding: 0;
margin: 0;
margin-top: 15px;
height: 380px;
}
.ui-block-a, .ui-block-b {
padding: 0;
margin: 0 auto;
height: 33.3%;
}
.ui-block-a *, .ui-block-b * {
margin: 0 auto;
text-align: center;
}
.ui-block-a a, .ui-block-b a {
width: 50%;
}
.ui-bar-a, ui-bar {
margin: 0 auto;
padding: 0;
height: 90%;
width: 90%;
max-width: 500px;
text-align: center;
/* Gradient set-up */
background: #3DC8F3 !important;
/* Border set-up */
border: 0px solid white;
border-radius: 0px;
box-shadow: 0px 0px 0px #000;
display: table;
}
.menu-elem {
margin: 0 auto;
text-align: center !important;
}
.menu-elem a {
text-decoration: none;
margin: 0 auto;
text-align: center !important;
}
.menu-elem .menu-text {
margin-top: 5px;
font-size: 0.9em;
color: #FFF;
text-align:center;
}
.ui-bar, .ui-body {
position: relative;
overflow: hidden;
display: block;
padding: 0.9em 1em !important;
clear: both;
text-align: center !important;
}

希望对您有所帮助!!

关于jquery - 文本对齐 :center not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30072206/

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