我创建一个表格。在那,我需要在同一行上添加文本框和提交按钮。
<div class="input-group">
<form action="searchresult.php" method="post">
<input type="text" name= "searchtext" class="form-control" placeholder="Search">
<button class="btn btn-secondary" type="submit">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-search" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414
1.415l-3.85-3.85a1 1 0 0 1 0-1.415z"/>
<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5
6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
</svg>
</button>
</form>
</div>
看起来您正在使用引导程序。
将两个元素包装在中row
并使用该column
结构。必要时调整填充/边距。有关更多信息,请查看网格系统上的引导程序文档:https : //getbootstrap.com/docs/4.0/layout/grid/
<div class="input-group">
<form action="searchresult.php" method="post">
<div class="row>
<div class="col-lg-6">
<input type="text" name= "searchtext" class="form-control" placeholder="Search">
</div>
<div class="col-lg-6">
` <button class="btn btn-secondary" type="submit">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-search" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414
1.415l-3.85-3.85a1 1 0 0 1 0-1.415z"/>
<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5
6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
</svg>
</button> `
</div>
</div>
</form>
</div>
这些列最多需要加12,所以您可以更改它,但要加起来。
col-lg-4
用于
col-lg-8
按钮的输入
否则,您想这样做。如果您需要更多地调整间距,我认为在Bootstrap 4中有一个用于控制元素填充的类:https :
//getbootstrap.com/docs/4.4/utilities/spacing/
例如,您可以将类添加p-0
到按钮,这将消除元素上的填充
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句