I'm currently designing the header for a website project. I have my logo positioned on the right side, and I want to place the search bar on the left side. To achieve this layout, I am utilizing flexbox in CSS.
I've experimented with various approaches, and here is the HTML code snippet I have implemented:
<body>
<header>
<div class="logo">
<logo picture/>
</div>
<div class="search-set">
<form id="s-bar-holder" role="search">
<input type="query" id="search-bar" name="q" placeholder="Search..." aria-label="Search the site."/>
</form>
</div>
<div></div>
</header>
<main></main>
</body>
Furthermore, here's the relevant CSS code that corresponds to the header styling:
header {
display: flex;
background-color: rgb(78,78,78);
margin-top: -8px;
margin-left: -7px;
margin-right: -8px;
height: 60px;
width: auto;
}
.logo {
height: 60px;
width: 300px;
overflow: hidden;
display: flex;
align-self: flex-start;
}
.logo > img {
width: 100%;
height: 100%;
object-fit: cover;
}
.search-set {
display: flex;
align-self: flex-end;
}
#search-bar {
background-color: rgb(78,78,78);
border: none;
color: rgb(230,230,230);
outline: none;
height: 58px;
width: 200px;
display: flex;
justify-content: wrap;
If you have any insights or suggestions, please feel free to share. Thank you!