【问题标题】:how to use bootstrap to align dropdown in angularjs application?如何使用引导程序在 angularjs 应用程序中对齐下拉菜单?
【发布时间】:2013-10-08 06:48:31
【问题描述】:

我是 bootstrap 新手,不知道如何使用它。我的 HTML 中有以下代码。我的项目中有 compass_twitter_bootstrap。

<div class="well">
    <h3>All Adventures</h3>

    <table>
    <tr><td>
    <select name="" id="" ng-model="category" ng-options="c for c in categories">
        <option value="">-- Choose Category --</option>
    </select>
    </td>
    <td><google-places location=location></google-places></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><select name="" id="" ng-model="tMode" ng-options="tM for tM in tModes">
        <option value="">-- Choose Transportation Mode --</option>
    </select></td>
    </tr>
    </table>
    <br/>
    <div ng-model="adventures"></div>
    <div ng-model="foods"></div>
    <div ng-model="arts"></div> 
    <div ng-model="histories"></div>
    <div ng-model="fitness"></div>
    <div ng-model="parks"></div>
    <div ng-model="photos"></div>
    <div ng-model="scavenger"></div>
    <div ng-model="shopping"></div>
    <div ng-model="sightseeing"></div>
    <div ng-model="specialevents"></div>    
    <div ng-model="ghosts"></div>
    <div ng-model="others"></div>
</div>

    <ul class="unstyled">
        <li ng-repeat="tour in tours">
            <div class="well">
                <h4>{{tour.name}}</h4>
                <a href="#/maps"><h5><em>{{tour.author}}</em></h5></a>
                <p>{{tour.category}}</p>
                <p>{{tour.createDate}}</p>
                <p>{{tour.dislikes}}% disliked it</p>
                <p>{{tour.duration}} minutes</p>
                <p>{{tour.likes}}% liked it</p>
                <h5><p>{{tour.stops.name0}}</p></h5>
                <h5><p>{{tour.stops.name1}}</p></h5>
                <h5><p>{{tour.stops.name2}}</p></h5>
                <h5><p>{{tour.stops.name3}}</p></h5>
                <p>{{tour.transportMode}}</p>
            </div>
        </li>
    </ul>

如附图所示,我有两个下拉框。谁能给我建议,告诉我如何使用引导程序并在 UI 中对齐下拉框和输入文本框?

【问题讨论】:

    标签: javascript html css twitter-bootstrap angularjs


    【解决方案1】:

    您使用的是&lt;table&gt;,因此如果希望所有字段都内联,您需要将所有字段包含在表的同一行中,如下所示:

    <table>
     <tr>
         <td>
            <select name="" id="" ng-model="category" ng-options="c for c in categories">
               <option value="">-- Choose Category --</option>
            </select>
       </td>
       <td>
         <google-places location=location></google-places>
       </td>
       <td>
         <select name="" id="" ng-model="tMode" ng-options="tM for tM in tModes">
             <option value="">-- Choose Transportation Mode --</option>
         </select>
       </td>
     </tr>
    </table>
    

    这对于任何 HTML 页面都是一样的 - 它与 bootstrap 或 AngularJS 没有直接关系

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-08
      • 1970-01-01
      • 1970-01-01
      • 2016-11-10
      • 2021-09-07
      • 1970-01-01
      • 2021-07-22
      相关资源
      最近更新 更多