Reputation: 19
I have a header with an image that would be the logo and a search bar on the right of it but the search box and the search button don't stick together
.header {
display: flex;
flex-direction: row;
padding-top: 20px;
padding-left: 10px;
background: white;
}
.header h1 {
font-size: 30px;
padding-right: 10px;
width: 30%;
}
#search-bar {
width: 60%;
height: 40px;
font-size: 1rem;
border: 1px solid #D0CFCE;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
#search-button {
width: 10%;
height: 40px;
font-size: 1rem;
border: 1px solid #D0CFCE;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
<div class="header">
<h1>
<a href="home"><img src="" alt="Company Logo"></a>
</h1>
<form action="search">
<input type="text" id="search-bar" placeholder="Search anything...">
<button type="submit" id="search-button">Search</button>
</form>
</div>
Also, how can I make the search bar and button bigger to the right while still being responsive (not wrapping, just getting smaller)?
Upvotes: 0
Views: 52
Reputation: 19
.header {
display: flex;
flex-direction: row;
padding-top: 20px;
padding-left: 10px;
background: white;
}
.header h1 {
font-size: 30px;
padding-right: 10px;
width: 30%;
}
#search-bar {
width: 60%;
height: 40px;
font-size: 1rem;
border: 1px solid #D0CFCE;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
#search-button {
height: 40px;
font-size: 1rem;
border: 1px solid #D0CFCE;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
.header form {
display: flex;
justify-content: center;
align-items: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="header">
<h1><a href="home"><img src="" alt="Company Logo"></a></h1>
<form action="search">
<input type="text" id="search-bar" placeholder="Search anything...">
<button type="submit" id="search-button">Search</button>
</form>
</div>
</body>
</html>
** You Cat Try With it **
Upvotes: 1