I trying to build a form. I want the text area as well as the background of the icon to change upon hovering. But I am unable to make them change at the same time.
.Input{
padding: 10px;
display: flex;
flex-direction: row;
align-content: stretch;
justify-content: center;
align-items: center;
}
.Icon{
border: 2px solid black;
height: 32px;
border-right: none;
padding-left: 4px;
width: 20px;
border-radius: 5px 0px 0px 5px;
}
.Formelement{
outline: none;
border: 2px solid black;
border-left: none;
border-radius: 0px 5px 5px 0px;
height: 30px;
width:30%;
}
.Formelement:focus,
.Formelement:hover{
border-color: green;
/* border: 2px solid green; */
background-color: beige;
}
.Icon:hover{
border-color: green;
background-color: beige;
}
Here is the code snippet:
import { FaUserCircle } from 'react-icons/fa';
import { MdErrorOutline } from 'react-icons/md';
import classes from './formElement.css';
const formElement = (props) => {
let input = null;
switch (props.elementType) {
case 'input':
input = <div className={classes.Input}>
<FaUserCircle className={classes.Icon}/>
<input className={classes.Formelement} type={props.elementConfig.type}
placeholder={props.elementConfig.placeholder}
onChange={props.changed} />
<MdErrorOutline/>
</div>
break;
default:
input = null;
}
I looked for some solutions and tried things like .Formelement:hover + .Icon:hover{ }
but i did not work. Please guide me through this problem.