How to Make a Nice Hover Effect With CSS
Transition animation in CSS (Cascading Style Sheets) to fuel your HTML components
This is where the fun begins when playing with some CSS properties. In any website front-end web development project that you have, you always have the parts that you want to have nice any good looking animation and transition effects.
CSS Transition has always been fun to use in making of web pages look cool and attractive. Any components in your website such as buttons, links, or cards can have animation effects.
There are several CSS transition property that can make your website looks cool. Transition can take almost other CSS properties that you want to animate such as opacity, background color, transform, and other properties. See this great explanatory post from Sara Cope about Transition Properties.
I will take you on two things I want to introduce into animating transitions. Buttons and Cards are popular HTML components that are widely used on websites.
1. Buttons
We can start with writing the HTML buttons to the canvas. You can use your own CSS style for the projects or use a CSS framework that you like. I use the Bootstrap 4 framework for this case.
HTML Setup:
SCSS Setup:
2. Cards
First thing, we use default Bootstrap cards and extend CSS transition animation on top of it, and lastly, we add some new transition animation.
The Cards SCSS:
The Cards HTML:
We can continue with animating transitions on cards with ::before
Pseudo-class elements. Using before property animation with transform transition:
The SCSS:
The HTML:
The CSS animation and transition effects will take on the start of the mouse hover and mouse out of the cards. The smooth transition can be changed in the CSS transition
property. The more you change the CSS animation transition properties, the more you understand how the effect works.
And lastly, we could use some modifications on the cards animate with CSS transform perspective property:
The SCSS :
Thank you for stopping by. This is one of my series about SCSS with Bootstrap and happy coding!
References :
https://sass-lang.com/
Sara Cope — https://css-tricks.com/almanac/properties/t/transition/
Read Also:
Closing
Please do follow me to get more tips and tricks from web development, thank you!