Title in my iOS app is shifted to the left from the center
Title in my application is shifted to the left from the center on iPhone, although when I open my app in the browser heading straight down the middle. How to fix it? here mine html code
<div data-view="Moobile.ScrollView" class="component-testpage-view"> <div data-role="navigation-bar" class="center"> <div data-role="button" data-name="back-button" data-style="back"> <div class="back"></div> </div> <div data-role="title" class="bar-center">Найдено</div> <div data-role="button" data-name="favorite" class="bar-right"> <div class="best"></div> </div> </div> <div data-role="content" data-name="category-field"> <div class="activity-text">Загрузка</div> <div data-role="activity-indicator" data-name="activity-indicator" class="activity-indicator active"></div> </div> </div>
mine css code `/* main-background -----------------------------------------------------------------------------*/
.main-background {-webkit-transition: all 0.5s; -webkit-transform: translateX(-50px); top: 44px;} .button-top {/overflow: auto; margin-top: -10px;/} .in-right {position: relative; height: 55px;}
.bar.navigation-bar.center .bar-item .bar-title-wrapper {pointer-events: none;} .bar.navigation-bar.center .bar-item .bar-title {height: 44px; line-height: 44px; left: 0px; position: absolute;}`
Have you tried changing/removing the css that says left:0px
? This is basically putting it as far left in its div as possible.
I would override that particular line of html and write it after the main CSS. Than use the normal way of centering text in a div.
To center text in a div
.bar-center {
margin-left: auto;
margin-right: auto;
width: 70%;
}
链接地址: http://www.djcxy.com/p/63036.html
上一篇: 以位置为中心的元素:绝对加零填充
下一篇: iOS应用中的标题从中心向左移动