Skip to content
Advertisement

conditional smooth CSS transition

Example Output

JSX code

JavaScript

Need CSS for this Example Output

Advertisement

Answer

Css: i have a div with display flex which makes img and the span align horizontally, inside my span i have a h1 and a p tag.

for the h1 i have set some css properties and a transformY(10px) that means i am moving it up 10px from its original position.and a transition with time and animation type.

for the p i have also set some properties and a opacityof 0;

then i am just saying if my wrapper has a class of online in it then do this to h1 and p.

i am toggling that online class with a button for demo purpose. but in real life it can be with anything.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement