MadsKaiser Posted March 3, 2020 Share Posted March 3, 2020 Hi! I started 2 days ago on css. I have mainly used html :) I ran into a little problem with hovering. I have an title and an subtitle. I want the title to move up a little and the subtitle to fade in when hovering over the background picture. So when "img-text-wrapper:hover" activates, i want to have it to have action in both ".subtitle" and ".subtitle2". I think it is because the padding of the subtitle is overlapping the padding of the title, so i cant do something like this, cause then the subtitle wont activate. I hope you understand :/ :/ .country:hover .subtitle2{ font-weight: 600; color: black; padding-bottom: 60%; } .img-text-wrapper:hover .subtitle{ font-weight: 600; color: lightseagreen } .country .subtitle2{ transition: 0.5s; font-weight: 600; font-size: 3.5em; color: rgb(197, 241, 239); padding: 0%; } .img-text-wrapper .subtitle{ transition: 0.5s; font-weight: 600; color: transparent; } Link to comment Share on other sites More sharing options...
Sherin Posted March 31, 2020 Share Posted March 31, 2020 You have declare to class name after hover but actually hover is pseudo-classes and it defines after class name .img-text-wrapper .subtitle :hover { font-weight:600; color:lightgreen; } .country .subtitle2 : hover { font-weight:600; color:black; padding-bottom:60%; } Link to comment Share on other sites More sharing options...
Inquirer Posted June 18, 2020 Share Posted June 18, 2020 <!DOCTYPE html> <html> <head> <style> .class { background-color: white; } .class:hover { background-color: grey; } </style> </head> <body> <div class="class">...</div> </body> </html> 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