Lord Eww Lel Lord Eww Lel - 10 days ago 5
CSS Question

How to Set Two Transition Durations for Multiple CSS Transforms

I would like the transform: translateY() transition and the transform: scale() transition to have a duration of 1.5 seconds and 0.5 seconds respectively. I can't seem to find a way to do this after multiple attempts and searches. Any help is appreciated. Thank you!

//..CSS..//

.circle1 {
z-index: 1056;
width: 80px;
height: 80px;
border-radius: 50%;
background: #BBBBBB;
position: fixed;
top: 150px;
margin: 0 auto;
left: 0;
right: 0;
color: white;
text-align: center;
font-family: Raleway-Light;
text-decoration: none;
list-style-type: none;
box-shadow: 0px 5px 8px rgba(0, 0, 0, 0.3);
-webkit-transition: 1.5s ease-in-out;
transition: 1.5s ease-in-out;
transform: translateY(2000px);
cursor: pointer;
}

.circle1.open {
transform: translateY(0px);
}

.circle1:hover {
transform: scale(1.2);
}

Answer

Use CSS transform:translateY(160px) scale(2.2)

see snippet below-

   

 .circle1 {
            z-index: 1056;
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: #BBBBBB;
            position: fixed;
            top:50px; 
            margin: 0 auto;
            left: 0;
            right: 0;
            color: white;
            text-align: center;
            font-family: Raleway-Light;
            text-decoration: none;
            list-style-type: none;
            box-shadow: 0px 5px 8px rgba(0, 0, 0, 0.3);
           -webkit-transition:  1.5s ease-in-out;
            transition: 1.5s ease-in-out;
            transform: translateY(50px);
            cursor: pointer;
    }


    .circle1:hover {
             transform:translateY(160px) scale(2.2);
    }
<div class="circle1">
</div>

Comments