2
<div data-role="header" id="commonHead">
    <div data-role="navbar">
        <h3 id="pageHeaderH1" alt="my root way to home" style="text-align:center;">myRWTH</h3> 
        <div data-role="controlgroup"  data-type="horizontal">
            <a href="index.html" data-role="button">Yes</a>
            <a href="index.html" data-role="button">No</a>
            <a href="index.html" data-role="button">Maybe</a>
        </div>
     </div>
</div> 

这是我的代码,但按钮不适合内容宽度,但与左侧对齐。我不明白我为什么不工作。有任何想法吗?

更新:我不知道为什么,但它不起作用。我的解决方法如下

<div data-role="header" id="commonHead" data-theme="b" >
    <div data-role="navbar" data-iconpos="right">
        <h3 id="pageHeaderH1" alt="my root way to home" style="text-align:center;" data-mini="true">myRWTH</h3> 
        <ul>     
         <li><a href="#popupBasic" data-rel="popup" data-type="vertical"  data-icon="gear" data-iconpos="bottom">Anzeigeoptionen</a>    
            <div data-role="popup" id="popupBasic" data-theme="b">
                <a id="ownPosition" data-role="button" data-icon="home" data-inline="true">Eigene Position</a>
                <a id="ownPosition" data-role="button" data-icon="minus" data-inline="true">Mensen</a>
                <a id="ownPosition" data-role="button" data-icon="minus" data-inline="true">HSP</a>
                <a id="ownPosition" data-role="button" data-icon="minus" data-inline="true">Gebäude</a>
                <a id="ownPosition" data-role="button" data-icon="minus" data-inline="true">Haltestellen</a>
                <a id="ownPosition" data-icon="delete" data-icon="home" data-inline="true">Alle ausblenden</a>
            </div> 
        </li>
         </ul>
     </div>
</div> 
4

3 回答 3

0

这样做的方法很多,这里有一个:

<div data-role="header" id="commonHead">
    <div data-role="navbar">
        <h3 id="pageHeaderH1" alt="my root way to home" style="text-align:center;">myRWTH</h3> 
        <div data-role="controlgroup"  data-type="horizontal">
            <div style="width: 33%; float: left; text-align: center">
            <a href="index.html" data-role="button">Yes</a>
            </div>
            <div style="width: 33%; float: left; text-align: center">
            <a href="index.html" data-role="button" style="width: 33%">No</a>
            </div>
            <div style="width: 33%; float: left; text-align: center">
            <a href="index.html" data-role="button" style="width: 33%">Maybe</a>
            </div>
        </div>
     </div>
</div> ​
于 2012-09-27T17:05:39.163 回答
0

尝试data-type="horizontal"单独添加到按钮。手动的

 <div data-role="header" id="commonHead">
 <div data-role="navbar">
    <h3 id="pageHeaderH1" alt="my root way to home" style="text-align:center;">myRWTH</h3> 
    <div data-role="controlgroup" >
        <a href="index.html" data-role="button" data-type="horizontal">Yes</a>
        <a href="index.html" data-role="button" data-type="horizontal">No</a>
        <a href="index.html" data-role="button" data-type="horizontal">Maybe</a>
    </div>
 </div>

于 2012-09-27T17:34:19.893 回答
0

您可能需要对其进行调整,这是一个技巧:

JS:

// override the jQM CSS
var cbnb = $('#customButtonNavbar');
var numberOfButtons = ($('.customButton').length > 0) ? $('.customButton').length:1;
var widthOfButtons = (Math.round(100 / numberOfButtons));

cbnb.children('.ui-controlgroup-controls').attr('style', 'width:100%;');
cbnb.children().children().attr('style', 'width:'+widthOfButtons+'%;');

HTML:

<div data-role="header" id="commonHead">
    <div data-role="navbar">
        <h3 id="pageHeaderH1" alt="my root way to home" style="text-align:center;">myRWTH</h3> 
        <div data-role="controlgroup" data-type="horizontal" id="customButtonNavbar">
            <a href="index.html" data-role="button" class="customButton">Yes</a>
            <a href="index.html" data-role="button" class="customButton">No</a>
            <a href="index.html" data-role="button" class="customButton">Maybe</a>
        </div>
     </div>
</div>​
于 2012-09-28T03:31:29.133 回答