<div id='searchParent'>
<!--icon to be hovered-->
<i id="search" class="fas fa-search"></i>
<!--icon to be hovered-->
<div id="inputParent">
<!--input to be shown-->
<input type="text" placeholder='Pesquise' autocomplete='off' id="input-bar">
<!--input to be shown-->
</div>
</div>
I´ve been working in this for a really long time, and the best piece of css hover i could get was this:
#search:hover ~ #inputParent #input-bar {
width: 200px;
}
But the problem is that when you hover the input it just drag it way out and you cant just write anything. The icons are in my local machine but i will prolably put them in there
EDIT: I´m going to show some of my poor css and what i was intending to do.
input {
border: none;
outline: none;
border-bottom: 0.3px solid black;
}
#search {
padding-left: 180px;
display: inline-block;
}
#inputParent {
margin-left: auto;
}
#input-bar {
margin-right: 1vw;
width: 0;
transition: 0.8s ease-in-out;
}
#search:hover ~ #inputParent #input-bar {
width: 200px;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
</head>
<body>
<div id="searchParent">
<i id="search" class="fas fa-search"></i>
<div id="inputParent">
<input type="text" placeholder="Pesquise" autocoplete="off" id="input-bar">
</div>
</div>
</body>
</html>
What i really wanted to do was to when i hovered the input it stay there. I really dont know why the bar is going from the left to the right, it was suposed to go backwards