내 입력 필드 (검색 상자)와 관련 아이콘 (돋보기 렌즈)을 float
내 웹 사이트의 탐색 모음 오른쪽 으로 만드는 방법을 찾을 수 없습니다 ( 내 로고는 탐색 왼쪽에두고 있음). 어떠한 제안?
HTML :
<nav>
<div class="nav-container">
<div class="logo">
<a href="">
<h1>MyWebsiteName.com</h1>
</a>
</div>
<form action="javascript:redirect()" autocomplete="off">
<input type="search" name="search" id="search" class="form-control">
<ul class=mylist list-group" id="result"></ul> <!--this line is for JS-->
<button type="submit">
<svg width="50" height="50" viewBox="0 0 77 77" fill="none"
xmlns="http://www.w3.org/2000/svg">
</svg> </button>
</form>
</div>
</nav>
CSS :
.nav-container {
display: flex;
align-items: center;
padding: 16px 0;
position: relative;
}
.nav-container form {
display: flex;
align-items: center;
justify-content: center;
}
nav input {
font-size: 1.20em;
border: solid 2px #E5E5E5;
border-radius: 25px;
background: none;
color: #F4F4F4;
padding: 14px;
margin: 0 20px 0 0;
width: 260px;
}
form {
float: right;
}
margin-left: auto;
대신 양식에 사용하십시오 float: right
.-플렉스 컨테이너 ( .nav-container
) 내부에 있습니다. 여기서 float는 효과적이지 않지만 margin-left: auto
최대한 오른쪽으로 이동합니다.
.nav-container {
display: flex;
align-items: center;
padding: 16px 0 16px 0;
position: relative;
}
.nav-container form {
display: flex;
align-items: center;
justify-content: center;
}
nav input {
font-size: 1.20em;
border: solid 2px #E5E5E5;
border-radius: 25px;
background: none;
color: #F4F4F4;
padding: 14px;
margin: 0 20px 0 0;
width: 260px;
}
form {
margin-left: auto;
}
<nav>
<div class="nav-container">
<div class="logo">
<a href="">
<h1>MyWebsiteName.com</h1>
</a>
</div>
<form action="javascript:redirect()" autocomplete="off">
<input type="search" name="search" id="search" class="form-control">
<ul class=mylist list-group " id="result "></ul> <!-- this line is for JS -->
<button type="submit ">
<svg width="50 " height="50 " viewBox="0 0 77 77 " fill="none "
xmlns="http://www.w3.org/2000/svg ">
</svg> </button>
</form>
</div>
</nav>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다