jquery 移动列表视图样式

发布于 2024-10-21 04:47:17 字数 3185 浏览 2 评论 0原文

我正在尝试设置列表视图控件的样式,但遇到问题...当我将图像宽度设置为 40px(如标记中所示)时。我似乎无法让内容正确地向左对齐。 IE。我不想要图像和文本之间的间隙。这是我的标记,

    <ul data-role="listview" class="ui-listview" data-inset="true" role="listbox">
        <li data-role="list-divider" role="heading" tabindex="0" class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-c" style='font-size:8pt;font-weight:normal'>
          <?php echo fmtDate($x->date); ?>,<?php echo $name; ?> wrote on <?php echo $wname; ?>'s wall
          <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style='right:55px;background: url(../images/comment.png) no-repeat;padding:3px;padding-left:20px'>34</span>
          <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style='right:5px;background: url(../images/like.gif) no-repeat;padding:3px;padding-left:20px'>442</span>
        </li>

        <li role="option" tabindex="0" data-theme="c" >
        <a href='#'>
        <img width="40" height="40" src='<?php echo $imgstr; ?>'/>
        <div style='font-size:9pt;font-weight:normal;'><?php echo nl2br(addSmilies(urlize(trim($x->msg))));?></div>                
        </a>
        </li>
    </ul> 

只是为了澄清这是我从“检查元素”获得的标记,

<ul data-role="listview" class="ui-listview ui-listview-inset ui-corner-all ui-shadow" data-inset="true" role="listbox">
                <li data-role="list-divider" role="heading" tabindex="0" class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-c ui-corner-top ui-btn-up-undefined" style="font-size:8pt;font-weight:normal">
                  Today, 55 minute(s) ago,Maggie Ferguson wrote on Maggie's wall
                  <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="right:55px;background: url(../images/comment.png) no-repeat;padding:3px;padding-left:20px">34</span>
                  <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="right:5px;background: url(../images/like.gif) no-repeat;padding:3px;padding-left:20px">442</span>
                </li>

                <li role="option" tabindex="-1" data-theme="c" class="ui-li-has-thumb ui-btn ui-btn-icon-right ui-li ui-corner-bottom ui-btn-up-c"><div class="ui-btn-inner"><div class="ui-btn-text">
                <a href="#" class="ui-link-inherit">
                <img width="40" height="40" src="../members/mariamjohnson/media/878_thumb.jpg" class="ui-li-thumb ui-corner-bl">
                <div style="font-size:9pt;font-weight:normal;">WAIT A MINUTE,GWE DAN CAN YOU PLEASE BEHAVE YOURSELF,IF YOU HAVE NOTHING TO DO ,GO GET YOURSELF WASTED ELSEWHERE,YOU ARE ABUSIVE AND YOU ARE BEGINING TO IRRETATE ME LIKE A RASH.GURU CHAIN HIM UP,HE SHOULD NOT SPEAK UNTIL SPOKEN TO ,OK?</div>                
                </a>
                </div><span class="ui-icon ui-icon-arrow-r"></span></div></li>
            </ul>

看起来像 jquery mobile 向 mrkup 添加了额外的内容和类...有什么解决方案吗? 在此处输入图像描述

im trying to style a listview control but im having problems... when i set width of image to 40px as shown in markup. i cant seem to get the content to align properly to the left. ie. i dnt want that gap between image and text. here is my markup

    <ul data-role="listview" class="ui-listview" data-inset="true" role="listbox">
        <li data-role="list-divider" role="heading" tabindex="0" class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-c" style='font-size:8pt;font-weight:normal'>
          <?php echo fmtDate($x->date); ?>,<?php echo $name; ?> wrote on <?php echo $wname; ?>'s wall
          <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style='right:55px;background: url(../images/comment.png) no-repeat;padding:3px;padding-left:20px'>34</span>
          <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style='right:5px;background: url(../images/like.gif) no-repeat;padding:3px;padding-left:20px'>442</span>
        </li>

        <li role="option" tabindex="0" data-theme="c" >
        <a href='#'>
        <img width="40" height="40" src='<?php echo $imgstr; ?>'/>
        <div style='font-size:9pt;font-weight:normal;'><?php echo nl2br(addSmilies(urlize(trim($x->msg))));?></div>                
        </a>
        </li>
    </ul> 

just to clarify this is the markup i get from 'inspect element'

<ul data-role="listview" class="ui-listview ui-listview-inset ui-corner-all ui-shadow" data-inset="true" role="listbox">
                <li data-role="list-divider" role="heading" tabindex="0" class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-c ui-corner-top ui-btn-up-undefined" style="font-size:8pt;font-weight:normal">
                  Today, 55 minute(s) ago,Maggie Ferguson wrote on Maggie's wall
                  <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="right:55px;background: url(../images/comment.png) no-repeat;padding:3px;padding-left:20px">34</span>
                  <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="right:5px;background: url(../images/like.gif) no-repeat;padding:3px;padding-left:20px">442</span>
                </li>

                <li role="option" tabindex="-1" data-theme="c" class="ui-li-has-thumb ui-btn ui-btn-icon-right ui-li ui-corner-bottom ui-btn-up-c"><div class="ui-btn-inner"><div class="ui-btn-text">
                <a href="#" class="ui-link-inherit">
                <img width="40" height="40" src="../members/mariamjohnson/media/878_thumb.jpg" class="ui-li-thumb ui-corner-bl">
                <div style="font-size:9pt;font-weight:normal;">WAIT A MINUTE,GWE DAN CAN YOU PLEASE BEHAVE YOURSELF,IF YOU HAVE NOTHING TO DO ,GO GET YOURSELF WASTED ELSEWHERE,YOU ARE ABUSIVE AND YOU ARE BEGINING TO IRRETATE ME LIKE A RASH.GURU CHAIN HIM UP,HE SHOULD NOT SPEAK UNTIL SPOKEN TO ,OK?</div>                
                </a>
                </div><span class="ui-icon ui-icon-arrow-r"></span></div></li>
            </ul>

looks like jquery mobile adds extra and classes to the mrkup... any solutions?
enter image description here

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

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

发布评论

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

评论(1

小ぇ时光︴ 2024-10-28 04:47:17

添加 jQuery mobile CSS 后添加 CSS 文件并用您喜欢的填充覆盖样式

.ui-li-has-thumb .ui-btn-inner {
    min-height: 60px;
    padding-left: 100px;
}

,例如

.ui-li-has-thumb .ui-btn-inner {
    min-height: 60px;
    padding-left: 60px;
}

Add a CSS file after you include the jQuery mobile CSS and overwrite the style

.ui-li-has-thumb .ui-btn-inner {
    min-height: 60px;
    padding-left: 100px;
}

with your preferred padding, e.g.

.ui-li-has-thumb .ui-btn-inner {
    min-height: 60px;
    padding-left: 60px;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文