html - 让 Bootstrap 下拉选择选项与文本字段内联

标签 html css twitter-bootstrap

我有一个水平表格,但我有一点使用“内联表格”。我几乎可以正常工作了,但是 我试图让内联表单按照我想要的方式运行,但我似乎被卡住了。

这是我目前拥有的 ( jsfiddle ):

<div class="form-group">
     <label class="col-lg-2 control-label">Email address</label>
     <div class="col-lg-10">
         <div class="form-inline">
             <select class="form-control">
                 <option selected="selected">http://</option>
                 <option>https://</option>
             </select>
             <input type="text" class="form-control" id="website" placeholder="Enter website"/>
         </div>
     </div>
</div>

我有两个问题:

<强>1。当屏幕全尺寸时,我希望文本输入占据剩余空间:

enter image description here

<强>2。我总是希望将“选择”框保留在输入字段的左侧,我不希望它们跳到两行

enter image description here

我尝试过使用各种长度的列,但这似乎不起作用。

最佳答案

将下拉菜单的宽度设置为 15%,将字段的宽度设置为 75%。然后将它们放在响应式容器中,并且随着站点大小的调整,它们应该保持正确的相对大小。唯一的问题是一旦达到移动尺寸,容器宽度的 15% 将非常小,从而切断下拉列表中的文本。您可以调整 responsive.css,以便在该尺寸下宽度大约为 30% 和 60%。

很高兴它成功了!

关于html - 让 Bootstrap 下拉选择选项与文本字段内联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24088404/

相关文章:

javascript - 为棘手的 Jquery 函数添加上下文

javascript - Bootstrap网格文本书写

twitter-bootstrap - 为什么 bootstrap 在我的手机上没有响应?

javascript - 错误 "Uncaught SyntaxError: Unexpected end of input"

jquery - HTML,自定义元素属性,适用于所有浏览器吗?

jquery - 在页面加载时随机排列 DIV

javascript - 准备好文档时触发弹出窗口或 div id

html - 'align-items-end' 如何在图像上叠加多个文本元素同时保持 block 状态

html - 可编辑的 html 组合框。如何为输入设置适当的宽度

css - 自定义 Bootstrap 、编辑或覆盖