jquery - Bootstrap 3 带标签的内联输入元素

标签 jquery html css twitter-bootstrap twitter-bootstrap-3

我正在尝试在一个非常小的列中实现内联表单,如下所示:

Inline form in 6 col size

我已经在 col-lg-x 中编写了一些希望在 chrome 中工作的代码,但是除此之外的任何其他大小,然后我的表单就会崩溃并转到一个新的列的行。

这是我的代码:

<div class="container">
    <div class="row">
        <div class="col-md-6 col-lg-6">
            <div class="form-group">
                <div class="form-inline">
                    <label style="
    font-size: 12px;
    max-wdith: 20% !important;
    width: 15%;
    padding-left: 5px;
    /* padding-right: 5px; */
">From</label>
                    <input class="form-control" placeholder="Email" type="text" style="
    padding: 0;
    border-radius: 2px !important;
    font-size: 13px;
    height: 25px;
    color: grey;
    /* margin-top: 3px; */
    width: 35%;
"> &nbsp;
                    <label style="
    font-size: 12px;
    max-wdith: 20% !important;
    width: 10%;
    /* padding-left: 5px; */
    /* float: left; */
    text-align: right;
">to</label>
                    <input class="form-control" placeholder="Password" type="password" style="
    padding: 0;
    border-radius: 2px !important;
    font-size: 13px;
    height: 25px;
    color: grey;
    /* margin-top: 3px; */
    width: 31%;
">
                </div>
            </div>
        </div>
    </div>
</div>

为什么会这样? 有什么办法可以解决这个问题吗?

注意:我这里所说的调整大小是指调整浏览器大小以检查不同的屏幕尺寸。

最佳答案

<div class="container">
    <div class="row">
        <div class="col-md-6 col-lg-6">
            <div class="form-group">
                <div class="form-inline">
    <style>
      
      .myfield{
          border: 1px solid #ccc!important;
          border-radius: 4px!important;
          font-size: 13px;
          height: 25px;
          color: grey;
          max-width: 100px !Important;
          width: 31%;
          padding: 2px 10px;
          box-shadow: inset 0px 0px 11px -5px #000;
      }
      input:focus{
          outline: initial;
          box-shadow: inset 0px 0px 11px -5px red;
      }
      label{
          font-size: 12px;
          max-width: 20px !important;
          width: 15%;
          padding-left: 5px;
      }

      @media screen and (min-width: 400px) {
         #Add here your code for different type of screen resolution
         .myfield{
             #My custom code here
             max-width: 80px !Important;
             width: 10%;
         }
      }
    </style>
                    <label>From</label>
                    <input class="form-control myfield" placeholder="Email" type="text" > &nbsp;
                    <label>to</label>
                    <input class="form-control myfield" placeholder="Password" type="password"  >
                </div>
            </div>
        </div>
    </div>
</div>

关于jquery - Bootstrap 3 带标签的内联输入元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35214942/

相关文章:

javascript - 处理 Angular 4 生命周期 Hook

jquery - 如何使用数据表对包含数字和图像的列进行排序

css:设置字体粗细

javascript - 滚动时如何使导航栏消失?

HTML 禁用 'id' 页面移动行为

jquery - 具有不同图像的 CSS/Jquery 选项卡

javascript - 简化功能,使代码不会变得太大

javascript - Jquery 工具提示总是将标题名称显示为工具提示

jquery - 将箭头包裹在 div : AnythingSlider 中

html - 如何在大分辨率屏幕上对齐水平菜单链接?