Skip to main content

Search box animation using HTML and CSS

 


HTML CODE:


<!DOCTYPE html>

<html>

<head>

 <meta charset="utf-8">

 <meta name="viewport" content="width=device-width, initial-scale=1">

 <title>Search box</title>

 <link rel="stylesheet" type="text/css" href="search.css">

 <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>

</head>

<body>

<div class="search-box">

 <input class="search-txt" type="text" name="" placeholder="Type to search">

 <a class="search-btn" href="#">

  <i class="fas fa-search"></i>

 </a>

</div>

</body>

</html>


CSS CODE:


body{

 margin: 0;

 padding: 0;

 background:#AAABAD;

}


.search-box{

 position: absolute;

 top: 50%;

 left: 50%;

 transform:translate(-50%, -50%);

 background: #2f3640;

 height: 40px;

 border-radius: 40px;

 padding: 10px;

}

.search-box:hover > .search-btn{

 background: #2f3640;

}


.search-btn{

 color: #AAABAD;

 float: right;

 width: 40px;

 height: 40px;

 border-radius: #2f3640;

 display: flex;

 justify-content: center;

 align-items: center;

 transition: 0.4s;

}


.search-box:hover > .search-txt{

 width: 240px;

 padding: 0 6px;

}


.search-txt{

 border: none;

 background: none;

 outline: none;

 float: left;

 padding: 0;

 color: white;

 font-size: 16px;

 transition: 0.4s;

 line-height: 40px;

 width: 0px;

}


Comments

Popular posts from this blog

Crab animation

HTML CODE: <! DOCTYPE html > < html lang = "en" >   < head >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" />     < title > Crab CSS Animation </ title >     <!-- Stylesheet -->     < link rel = "stylesheet" href = "css/crab.css" />   </ head >   < body >     < div class = "container" >       < div class = "crab" >         < div class = "hand" >           < div class = "claw-1-l" ></ div >           < div class = "claw-1-r" ></ div >           < div class = "claw-2-l" ></ div >           < div class = "claw-2-r" ></ div >         </ div >         < div class = "mouth" ...

Toggle animation using CSS!!!

HTML CODE: <! DOCTYPE html > < html > < head >     < meta charset = "utf-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1" >     < title > Toggle </ title >     < link rel = "stylesheet" href = "Toggle.css" > </ head > < body > < input type = "checkbox" id = "day-night" >< label for = "day-night" ></ label > < div class = "content" >         < div class = "moon-sun" ></ div >     < div class = "cuboid floor one" >         < div class = "side" ></ div >         < div class = "side" ></ div >         < div class = "side" ></ div >         < div class = "side" ></ div >         < div class = "side" ></ div >   ...

Animated amongus !!!

HTML CODE: <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > Among Us </ title >     < link rel = "stylesheet" href = "amongus.css" > </ head > < body >     < div class = "player" >         < div class = "visor" ></ div >         < div class = "backpack" ></ div >         < div class = "leg front" ></ div >         < div class = "leg back" ></ div >         < div class = "shade" ></ div >     </ div > </ body > </ html > CSS CODE: html , body {     height : 100vh ; } body {     display : flex ;     align-items : center ; ...