gpt4 book ai didi

jquery - 如何在 "navbar"的navbar品牌下设置一个inline form占100%宽度

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

This is how it is coming right now, notice the black gap, plus the navbar-brand and navbar form seem to be coliding我对 Bootstrap 很陌生。我试图在导航栏品牌旁边的导航栏中有一个内联表单。在调整窗口大小(响应性)时,表单出现在导航栏品牌链接下方,但它并没有 100% 出现,因此看起来很尴尬。谁能告诉我哪里出错了。这是完整的html代码, This is how i want, on resizing, no gap should come, plus the navbar brand should not overlap the form. Bootstrap 101 模板

    <!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">

</head>
<body>
<div class = "navbar navbar-inverse navbar-fixed-top"><!--style = "background-image: url('Images/logo.png'); background-size: contain; background-repeat: repeat;"-->
<div class = "row">
<div class = "navbar-header col-lg-4 col-sm-12 col-xs-12 pull-left" style = "background-color: red; height: 100%;">
<a class = "navbar-brand" href = "#">JanaSena Party</a>
<button class = "navbar-toggle pull-right" data-toggle = "collapse" data-target = ".navHeaderCollapse">JSP</button>
</div>
<div class = "collapse navbar-collapse navHeaderCollapse col-lg-8 col-xs-12 pull-right" style = "background-color: green;">
<form class="navbar-form" role = "form" style = "margin: 0; width: 100%; background-color: blue;">
<div class="form-group">
<label class="control-label">Username</label>
<input type="text" class="form-control" placeholder="Enter Username">
</div>
<div class="form-group">
<label class="control-label">Password</label>
<input type="password" class="form-control" placeholder="Password">
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Remember me
</label>
</div>
<button type="submit" class="btn btn-default navbar-btn">Sign in</button>
</form>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>

最佳答案

Bootstrap :http://www.bootply.com/129779

CSS :

.navbar-header{
float:none;
}

.navHeaderCollapse{
width:100%;
}

HTML:

 <div class="navbar navbar-inverse navbar-fixed-top"><!--style = "background-image: url('Images/logo.png'); background-size: contain; background-repeat: repeat;"-->
<div class="row">
<div class="navbar-header col-lg-4 col-sm-12 col-xs-12" style="background-color: red; height: 100%;">
<a class="navbar-brand" href="#">JanaSena Party</a>
<button class="navbar-toggle pull-right" data-toggle="collapse" data-target=".navHeaderCollapse">JSP</button>
</div>
<div class="collapse navbar-collapse navHeaderCollapse col-lg-8 col-xs-12" style="background-color: green;">
<form class="navbar-form" role="form" style="margin: 0; width: 100%; background-color: blue;">
<div class="form-group">
<label class="control-label">Username</label>
<input type="text" class="form-control" placeholder="Enter Username">
</div>
<div class="form-group">
<label class="control-label">Password</label>
<input type="password" class="form-control" placeholder="Password">
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Remember me
</label>
</div>
<button type="submit" class="btn btn-default navbar-btn">Sign in</button>
</form>
</div>
</div>
</div>

更新:

bootply:http://www.bootply.com/129807

CSS:

@media screen and (max-width:992px){

.navbar-header{
float:none;

}

.navHeaderCollapse{
width:100%;
float:left;

}

}

关于jquery - 如何在 "navbar"的navbar品牌下设置一个inline form占100%宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23056196/

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