我正在开发一个 ASP.Net MVC 元素,我在其中使用一些 Bootstrap 类添加了一个搜索文本框:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<form method="g" action="@Url.Action("Index")">
<div class="input-group">
<input type="search"
name="searchTerm"
class="form-control"
placeholder="Search for..."
style="width: 100%;" />
<span class="input-group-btn">
<input type="submit" value="Search" class="btn btn-default" />
</span>
</div>
</form>
</div>
<div class="col-lg-3">
</div>
</div>
如您所见,搜索文本框和“搜索”按钮之间有一个空格。我尝试使用内联style="width: 100%;"让输入搜索的宽度覆盖所有长度,并让文本框和搜索按钮彼此关闭。
我在上面的代码中遗漏了什么吗?
最佳答案
请删除 style="width: 100%;"/>
。因为bootstrap已经自动调整了宽度
关于html - 输入搜索中的宽度不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46722638/