<div class="container">
<input type="text" placeholder="Search..">
<div class="search"></div>
@import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
}
body {
background: #222222;
}
.container {
position: absolute;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 300px;
height: 100px;
}
.container .search {
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 50px;
height: 50px;
background: #fff;
border-radius: 50%;
transition: all 1s;
z-index: 4;
/* box-shadow: 0 0 25px 0 rgba(0, 0, 0, 0.4); */
}
.container .search:hover {
cursor: pointer;
}
.container .search::before {
content: "";
position: absolute;
margin: auto;
top: 10px;
right: 8px;
bottom: -5px;
left: 22px;
width: 12px;
height: 2px;
background: #111;
transform: rotate(45deg);
/* transition: all .5s ease; */
}
.container .search::after {
content: "";
position: absolute;
margin: auto;
top: -5px;
right: 0;
bottom: 0;
left: -5px;
width: 15px;
height: 15px;
border-radius: 50%;
border: 2px solid #111;
/* transition: all .5s; */
/* transition: all .5s ease-in-out; */
}
.container input {
font-family: 'Open Sans', sans-serif;
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 50px;
height: 50px;
outline: none;
border: none;
background: #fff;
color: #111;
/* text-shadow: 0 0 10px crimson; */
padding: 0 80px 0 20px;
border-radius: 30px;
box-shadow: 12px 13px 25px 0 #111, 8px 9px 25px 0 rgba(0, 0, 0, 0.2);
transition: all 1s;
opacity: 0;
z-index: 5;
font-weight: bolder;
letter-spacing: 0.1em;
}
.container input:hover {
cursor: pointer;
}
.container input:focus {
width: 300px;
opacity: 1;
cursor: text;
}
.container input:focus~.search {
right: -240px;
background: transparent;
z-index: 6;
}
.container input:focus~.search::before {
top: 28px;
left: 15px;
width: 25px;
height: 2px;
bottom: 25px;
}
.container input:focus~.search::after {
top: 29px;
left: -8px;
/* width: -25px; */
width: 25px;
right: -15px;
height: 2px;
border: none;
bottom: 25px;
/* margin: -25px 0px 0px 20px; */
background: #111;
border-radius: 0%;
transform: rotate(-45deg);
}
.container input::placeholder {
color: #111;
opacity: 0.5;
font-weight: bolder;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.