caleb1 Posted May 24, 2019 Share Posted May 24, 2019 Does anyone know if there is a way to set properties to an element when it is hovered over using the same selector as the proporties for when it is not hovered over? For example something like: .myclass { background-color:green; background-color:hover:blue; (or something like that) } Rather than: .myclass { background-color:green } .myclass:hover { background-color:blue } Thanks, Link to comment Share on other sites More sharing options...
Funce Posted May 26, 2019 Share Posted May 26, 2019 This seems.... specific. Are you looking for a shorthand notation? Or does this relate to another project. Happy to go through any part of how the CSS works in this case. I'm not aware of any alternate forms of styling with attributes/pseudo-selectors. Link to comment Share on other sites More sharing options...
shaili_shah Posted July 16, 2019 Share Posted July 16, 2019 you have to apply hover effect by using this approach: .myclass { background-color:green } .myclass:hover { background-color:blue } you can refer the below link: https://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_hover Link to comment Share on other sites More sharing options...
ishan_shah Posted December 20, 2019 Share Posted December 20, 2019 Hello @caleb1, You should use the pseudo-class to be more effective and attractive UI effects. kindly refer to the following link for more reference and understanding.https://www.w3schools.com/css/css_pseudo_classes.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now