如何创建一个 jquery mobile 有序列表,并将列表符号设置为外部?

发布于 2024-11-06 12:42:51 字数 567 浏览 2 评论 0原文

<ol data-role="listview">
    <li>
        <h3>heading</h3>
        <p>description</p>
    </li>
</ol>

结果是:

   1.
   Heading 
   Description

我想要:

    1.    Heading
          Description

我本以为我可以将 list-style-position:outside 作为带有 li 标签的内联样式。运气不好。如果我删除列表视图数据角色,则样式将正确应用。

一些listview日期角色是如何操纵样式的,但我不知道如何...我在jquery mobile css和js文件中搜索了list-style-position行,但没有返回结果,什么这是怎么回事?

请帮忙吗?

附言。使用jquery移动1.0a4.1

<ol data-role="listview">
    <li>
        <h3>heading</h3>
        <p>description</p>
    </li>
</ol>

The result is:

   1.
   Heading 
   Description

I want:

    1.    Heading
          Description

I would have thought I could have stuck list-style-position:outside as an inline style with the li tag. No luck. If I remove the listview data-role, the style is applied correctly.

Some how the listview date-role is manipulating the styles, I can't figure out how though... I've searched for the list-style-position line in the jquery mobile css and js files and no results were returned, what is going on here?

Some help please?

PS. using jquery mobile 1.0a4.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

久伴你 2024-11-13 12:42:51

看起来您需要添加一些自定义 CSS

Live 示例: http://jsfiddle.net/7Bn2z/43/
实例#2:
http://jsfiddle.net/7Bn2z/48/ (修复了布局小)

HTML:

<div data-role="page" data-theme="b" id="jqm-home">
    <div data-role="content"> 
        <ol data-role="listview">
            <li>
                <span>
                    <span class="oi-li-heading">heading</span>
                    <span class="oi-li-desc">description</span>
                </span>
            </li>
        </ol>
    </div>
</div>

CSS:

.oi-li-heading {
    font-size: 16px;
    font-weight: bold;
    margin: .6em 0;
}

.oi-li-desc {
    font-size: 12px;
    font-weight: normal;
    margin: -.5em 0 .6em;
}

更新:

如果您安装了 Chrome,您可以右键单击此处的示例页面: http:// jsfiddle.net/7Bn2z/49/ 并检查元素。正如您所看到的,jQM 添加了 CSS 的标签,

因此在示例中我们从以下内容开始:

<ol data-role="listview">
    <li>
        <h3>heading</h3>
        <p>description</p>
    </li>
</ol>

jQM 将其标签添加到此:

<ol data-role="listview" class="ui-listview">
    <li class="ui-li ui-li-static ui-body-c">
        <h3 class="ui-li-heading">heading</h3>
        <p class="ui-li-desc">description</p>
    </li>
</ol>

Looks like you need to add some custom CSS

Live Example: http://jsfiddle.net/7Bn2z/43/
Live Example #2: http://jsfiddle.net/7Bn2z/48/ (Fixed the layout a little)

HTML:

<div data-role="page" data-theme="b" id="jqm-home">
    <div data-role="content"> 
        <ol data-role="listview">
            <li>
                <span>
                    <span class="oi-li-heading">heading</span>
                    <span class="oi-li-desc">description</span>
                </span>
            </li>
        </ol>
    </div>
</div>

CSS:

.oi-li-heading {
    font-size: 16px;
    font-weight: bold;
    margin: .6em 0;
}

.oi-li-desc {
    font-size: 12px;
    font-weight: normal;
    margin: -.5em 0 .6em;
}

UPDATE:

If you have chrome installed you can right click the example page here: http://jsfiddle.net/7Bn2z/49/ and inspect element. As you can see jQM adds a to of CSS

So in the example we start off with:

<ol data-role="listview">
    <li>
        <h3>heading</h3>
        <p>description</p>
    </li>
</ol>

And jQM adds it's tags to this:

<ol data-role="listview" class="ui-listview">
    <li class="ui-li ui-li-static ui-body-c">
        <h3 class="ui-li-heading">heading</h3>
        <p class="ui-li-desc">description</p>
    </li>
</ol>
挽清梦 2024-11-13 12:42:51

在我的 jquery 移动应用程序中创建编号列表时,我遇到了同样的问题。下面的 CSS 解决了我的问题:

  ol.ui-listview .ui-li-heading {
    display: inline-block;
    width: 100%;
    margin-left: -1.3em;
    text-indent: 1.3em;
    vertical-align: middle;
  }

I had the same issue when creating a numbered list in my jquery mobile app. The css below fixed the problem for me:

  ol.ui-listview .ui-li-heading {
    display: inline-block;
    width: 100%;
    margin-left: -1.3em;
    text-indent: 1.3em;
    vertical-align: middle;
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文