javascript - 如何使用 bootstrap 对齐 angularjs 应用程序中的下拉列表?

标签 javascript html css twitter-bootstrap angularjs

我是 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>

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

enter image description here

最佳答案

您正在使用 <table>所以如果想要所有的字段都是内联的,你需要将所有的字段包含在表格的同一行中,就像这样:

<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 没有直接关系

关于javascript - 如何使用 bootstrap 对齐 angularjs 应用程序中的下拉列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19234318/

相关文章:

java - 在 javascript 代码中读取 jSTL 变量。

javascript - Ajax:构建 HTML 与注入(inject) HTML

javascript - javascript中对象的初始化在编译时不起作用

javascript - 如何从输入更改 src?

php - 不明白为什么我的联系表不发送电子邮件

javascript - 传递动态数据 Victory-native 图表

javascript - 有什么方法可以将 Google 网络/自定义搜索结果显示到另一个 UI 中?

javascript - 从前端将客户端文件传递给 webassembly

html - 如何像 Pinterest 一样在 CSS 中将 div 垂直对齐在一起

css - 从 Material UI (mui) 中的 DataGrid 中移除底部边框