CSS Hover | css hover effect | css button hover effects
Hey friends, today I’ll teach how to use the hover property in CSS and where to use it. Before we dive in, i’ll introduce myself. I’m CodingPorium and I make coding tutorials and provide Free Source Code. Do check out my YouTube channel at here or by searching for CodingPorium on YouTube for more!
So before entering, let’s understand what is the hover property. The hover property is something common which you might have seen and used in many websites as it’s an essential component in websites.
Generally, it’s used for buttons but can also be used for other elements according to your own creativity. Here’s a simple demo (from 0:00 to 0:22) :
Okay, now let’s see the basic code for it first.
button hover effect CODE
For this selector, we first add the following code in HTML
In our CSS, we will add the following code
The Output would be:
Now this is just the basics. Let’s see how to upgrade these basic skills now.
button Fade Transition using Hover Selector
We can easily make a fade effect by adding the following line of code in our CSS for button (not the hover one):
Creative Ideas for :hover
Instead of just using :hover for links and buttons, you can also consider using it for other components. For example, a CSS card which enlarges in size when hovered. You can also use it for CSS Animations on Text. Besides, I’ve made a video tutorial last time on how to make CSS social media buttons with hover effects at here. Do explore methods of using these and your skills in :hover will get better.
hover effect Browser Support
The most confusing thing in properties like this is browser support. :hover works in most modern browsers. However, for Internet Explorer you need to declare the <!DOCTYPE> if you’re using :hover in elements besides the <a> element.
Check it more