gpt4 book ai didi

html - 使用 Bootstrap 使搜索输入宽度为 100%

转载 作者:行者123 更新时间:2023-11-28 15:20:13 26 4
gpt4 key购买 nike

我试图在调整屏幕大小时使我的搜索输入宽度为 100%(使用 @media (max-width: 1200px)),但它不起作用。问题:

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;
}
}

最佳答案

将媒体查询更改为@media (min-width: 1200px) 而不是 max-width。

关于html - 使用 Bootstrap 使搜索输入宽度为 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36237042/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com