2016-03-26 123 views
0

我想讓我的搜索輸入寬度100%在屏幕重新大小(使用@media(max-width:1200px)),但它不起作用。 問題:使用引導搜索輸入寬度100%

enter image description here

應該如何(我能正確使用的像素精確寬度值,使,但我不認爲我在做它的權利):

enter image description here

的index.html文件

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<title>MONI BAU</title> 
<link rel="icon" href="Fotot/icon.png"> 
<link href="Css/bootstrap.css" rel="stylesheet"> 
<link rel="stylesheet" href="Css/style.css"> 
</head> 
<body> 
<div class="container"> 
<nav class="navbar navbar-default"> 

     <div class="navbar-header"> 
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mainNavBar"> 
       <span class="icon-bar"></span> 
       <span class="icon-bar"></span> 
       <span class="icon-bar"></span> 
      </button> 
      <a href="#" class="navbar-brand"><img src="Fotot/logo.png" width="200px"></a> 
     </div> 
     <div class="collapse navbar-collapse" id="mainNavBar"> 
      <div class="paddingSearch navbar-right"> 
       <form class="navbar-form" role="search"> 
        <div class="input-group"> 
         <input type="text" class="form-control" placeholder="Kërko" name="q"> 
          <div class="input-group-btn"> 
           <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button> 
          </div> 
        </div> 
       </form> 
      </div>    
      <ul class="nav navbar-nav navbar-right paddingSearch"> 
       <li><a href="#"><i class="glyphicon glyphicon-home">  </i>Kryefaqja</a></li> 
       <li><a href="#"><i class="glyphicon glyphicon-wrench"></i>Produktet</a></li> 
       <li><a href="#"><i class="glyphicon glyphicon-envelope"></i>Kontakt</a></li> 
       <li><a href="#"><i class="glyphicon glyphicon-user"></i>Për Ne</a></li> 
      </ul> 
     </div> 
</nav> 
</div> 

<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script> 
<script type="text/javascript" src="JS/bootstrap.min.js"></script> 
</body> 
</html> 

和我的自定義的style.css

body{ 
background-image: url(../Fotot/background.png); 
margin: 0; 
padding: 0; 
font-family: Century Gothic,CenturyGothic,AppleGothic,sans-serif; 
} 
.navbar-brand { 
height: 80px; 
} 
.paddingSearch 
{ 
padding-top: 15px; 
padding-bottom:15px; 
margin: 0; 
color: #1a0000; 
font-size: 12pt; 
} 
.paddingSearch i{ 
color: black; 
width: 20px; 
} 
.navbar-toggle { 
padding: 10px; 
margin: 25px 15px 25px 0; 
} 
.navbar-brand { 
display: flex; 
align-items: center; 
} 

@media (max-width: 1200px) { 
.navbar-header { 
    float: none; 
} 
.navbar-left,.navbar-right { 
    float: none !important; 
} 
.navbar-toggle { 
    display: block; 
} 
.navbar-collapse { 
    border-top: 1px solid transparent; 
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); 
} 
.navbar-fixed-top { 
    top: 0; 
    border-width: 0 0 1px; 
} 
.navbar-collapse.collapse { 
    display: none!important; 
} 
.navbar-nav { 
    float: none!important; 
    margin-top: 7.5px; 
} 
.navbar-nav>li { 
    float: none; 
} 
.navbar-nav>li>a { 
    padding-top: 10px; 
    padding-bottom: 10px; 
} 
.collapse.in{ 
    display:block !important; 
} 
.navbar-nav .open .dropdown-menu { 
    position: static; 
    float: none; 
    width: auto; 
    margin-top: 0; 
    background-color: transparent; 
    border: 0; 
    -webkit-box-shadow: none; 
    box-shadow: none; 
} 
} 

回答

-1

更改媒體查詢@media(最小寬度:1200像素),而不是最大寬度。

+0

不行,不行。 – ASTeam

+0

把它放在一個JSFiddle上。在那裏調試會更容易。 – Ashwin