Tue Jul 05 2022
Expanding Search Bar
CSS5717 views
File Name: expanding-searchbar.html
<!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>Expanding Search Bar</title>
<style>
* {
margin: 0;
padding: 0;
outline: 0;
}
body {
background-color: #383838;
}
section {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
input[type=search] {
width: 160px;
padding: 8px 20px 8px 45px;
border:#fff solid 2px;
font-size: 18px;
border-radius: 25px;
background-position: 2% 50%;
background-repeat: no-repeat;
background-size: 30px;
background-image: url('search.svg');
background-color: transparent;
transition: 0.5s all ease-in-out;
filter: brightness(170%);
}
input[type=search]:focus,
input[type=search]:not(:placeholder-shown) {
width: 350px;
background-color: #fff;
filter: brightness(100%);
}
</style>
</head>
<body>
<section>
<form action="">
<input type="search" placeholder="Search..." />
</form>
</section>
</body>
</html>
Result Screenshot(s)
Author:Geekboots