我正在使用引導程式創建一個搜索欄,問題是我希望它與導航欄的右側對齊,而不是留在左側。這是問題:

僅供參考,搜索文本與徽標重疊,但我們無需擔心。問題是我希望搜索欄位于螢屏的右側。順便說一句, navbar 元素的父級是 container-fluid,而不是 row。
為什么它不與導航欄的右側對齊?
#search-bar {
background: #FFFFFF;
float: right;
height: 28px;
width: 32%;
margin-right: 40px
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<nav class="navbar col-12"> <img class="navbar-brand" src="https://via.placeholder.com/50" alt="Ventr Logo" width="100">
<input class="form-control" type="text" placeholder="Search" aria-label="Search" id="search-bar" align="right">
</nav>
uj5u.com熱心網友回復:
已解決,對此不需要 Bootstrap,我將使用常規的HTML和CSS.
uj5u.com熱心網友回復:
去看看預先構建的引導導航。在大多數情況下,它們是我需要的基礎。您可以根據需要自定義它們。提供了代碼,搜索欄從一開始就向右對齊。
https://getbootstrap.com/docs/5.0/components/navbar/
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/437648.html
上一篇:如何從blazorwebassembly組件代碼關閉引導模式?
下一篇:Bootstrap等于列高大小
