다음과 같이 보이도록 div 내부에 검색 창을 배치하고 싶습니다.
현재로서는 div 내에 있지 않습니다.
HTML :
.sb-search {
float: right;
overflow: hidden;
}
.sb-search-input {
border: none;
outline: none;
background: #fff;
width: 100%;
height: 60px;
margin: 0;
z-index: 10;
padding: 20px 65px 20px 20px;
font-family: inherit;
font-size: 20px;
color: #2c3e50;
}
<div class="searchbar" style="position: relative;">
<h1>Welcome Solictior...</h1>
<div id="sb-search" class="sb-search">
<form>
<input class="sb-search-input" placeholder="Search..." type="text" value="" name="search" id="search" />
<input class="sb-search-submit" type="submit" value="" />
<span class="sb-icon-search"></span>
</form>
</div>
</div>
Flexbox로하는 것은 매우 쉽습니다.
.searchbar {
background-color: #8BCAC7;
display: flex;
justify-content: space-between;
align-items: center;
}
https://jsfiddle.net/cb3fu9wj/
justify-content
주축을 따라 정렬을 지정합니다. 요소간에 여유 공간이 분배되는 방법을 정의합니다.
align-items
교차 축을 따라 정렬을 지정합니다.
여기에 완전한 가이드가 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다