2017-02-25 73 views
0

我要让按钮相同的宽度作为输入:引导形式,内嵌按钮宽度

enter image description here

我的html代码:

<form class="form-inline"> 
       <div class="form-group"> 
        <input class="form-control input-lg" type="text" name="category" placeholder="Категория"/> 
       </div> 
       <div class="form-group"> 
        <input class="form-control input-lg" type="text" name="city" placeholder="Город"/> 
       </div> 
       <div class="form-group"> 
        <input class="form-control input-lg" type="text" name="when" placeholder="На этой неделе"/> 
       </div> 
       <div class="form-group"> 
        <a class="btn btn-primary btn-lg btn-block">Найти</a> 
       </div> 
      </form> 

回答

1

只需添加填充像this--按钮

.btn-lg { 
padding-left:15px; 
padding-right:15px; 
    } 

根据您的需要更改值。

+0

它的工作原理,但我需要相同的响应宽度作为输入有 – nllsdfx

+0

给%的值。这将使其响应..我不认为引导程序有这个专项工作的任何自定义类 – neophyte

0

您需要应用不同尺寸的自定义样式。您可以使用下面的CSS作为以相应的方式使按钮宽度相同的起点。

/*========== Mobile First Method ==========*/ 

/* Custom, iPhone Retina */ 
@media only screen and (min-width : 320px) { 
} 

/* Extra Small Devices, Phones */ 
@media only screen and (min-width : 480px) { 
} 

/* Small Devices, Tablets */ 
@media only screen and (min-width : 768px) { 
} 

/* Medium Devices, Desktops */ 
@media only screen and (min-width : 992px) { 
} 

/* Large Devices, Wide Screens */ 
@media only screen and (min-width : 1200px) { 
} 

/*========== Non-Mobile First Method ==========*/ 

/* Large Devices, Wide Screens */ 
@media only screen and (max-width : 1200px) { 
} 

/* Medium Devices, Desktops */ 
@media only screen and (max-width : 992px) { 
} 

/* Small Devices, Tablets */ 
@media only screen and (max-width : 768px) { 
} 

/* Extra Small Devices, Phones */ 
@media only screen and (max-width : 480px) { 
} 

/* Custom, iPhone Retina */ 
@media only screen and (max-width : 320px) { 
} 

例如:

@media only screen and (min-width: 480px) { 
    .btn { 
     width: 100px; 
    } 
} 

您应该确定每一个媒体的不同尺寸。