JQuery Mobile 标题对齐变得困惑

标签 jquery html css jquery-mobile

使用 JQueryM,我正在尝试开发一个应该看起来像这样的 header

<小时/>

|[菜单图标]门票(左对齐)----------------[搜索图标][加号图标]

<小时/>

我的标记是这样的

       <div data-role="header" data-position="fixed">
            <a data-iconpos="notext" href="#panel" data-role="button" data-icon="flat-menu"></a>
            <h1 align="left">tickets</h1>

            <a href="#page-new-ticket" id="btn-new-ticket" data-role="button" data-icon="flat-search" data-iconpos="notext" data-inline="true"></a>                         
            <a href="#page-new-ticket" id="btn-new-ticket" data-role="button" data-icon="flat-plus" data-iconpos="notext" data-inline="true"></a> 
        </div>

这显然不会产生所需的结果。我尝试了很多方法包括 Aligning the Jquery mobile header title

.ui-title {
        margin     : 0.6em 1em  50px !important;
        text-align : left !important;}

但现在我已经到了一个我似乎迷失的地方。有人可以看一下这个吗?

最佳答案

好了,HTML:

<div data-role="header" data-position="fixed">
    <a class="ui-btn-left" data-iconpos="notext" href="#panel" data-role="button" data-icon="flat-menu"></a>
    <h1 class="ui-btn-left spacerleft" >tickets</h1>

    <a class="ui-btn-right spacerright" href="#page-new-ticket" id="btn-new-ticket" data-role="button" data-icon="search" data-iconpos="notext" data-inline="true"></a>                         
    <a class="ui-btn-right" href="#page-new-ticket" id="btn-new-ticket" data-role="button" data-icon="plus" data-iconpos="notext" data-inline="true"></a> 
</div>

CSS:

.spacerleft
{
    margin-left: 50px !important;
}
.spacerright
{
    margin-right: 50px !important;
}

<强> JSFiddle

关于JQuery Mobile 标题对齐变得困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24550325/

相关文章:

html - 我如何水平对齐我的盒子?

php - 发送带有 php 附件的电子邮件

javascript - 如何将数组值添加在一起直到它们达到特定数字,然后使用添加的值创建对象?

html - 如何在 Django 中制作 slider ?

比较 sessionStorage 值时无法调用 Javascript 函数

html - 想要通过从页面顶部引入图像来实现滑动显示过渡

javascript - 替代 Jquery 鼠标事件

php - 样式化的单选按钮(jquery?)

html - 如何将页脚固定到页面底部?

html - 如何使用 CSS 将图像应用于特定边框?