Home > Back-end >  how to add 2 transition in CSS but none of the m work?
how to add 2 transition in CSS but none of the m work?

Time:05-20

I am very new and learning CSS . I am trying to make this work but for some reason I can't. I would appreciate any help. Here what I have:

<!DOCTYPE html>
<html>
<head>
<style>

div a {
  text-decoration: none;
  color: yellow;
  font-size: 20px;
  padding: 15px;
  display:inline-block;
  background-color: green;
  filter: saturate(0);
  transition: transform .2s; 
  transition: filter .5s;
  border-radius:10px
  
  
}

div a:hover {background-color: green;filter: saturate(100%);filter:drop-shadow(10px 10px 5px black);round-corner:10px;border-radius:10px;transform: Scale(1.1);}


</style>
</head>
<body>

<div>
  <a href="#">Sample</a>


</body>
</html>

CodePudding user response:

You don't need to use the transition attribute twice to do two different transitions, you can apply them to the same attribute using a comma to separate the attributes you're targeting and the timing of those attributes. See: https://www.w3schools.com/css/css3_transitions.asp

div a {
  text-decoration: none;
  color: yellow;
  font-size: 20px;
  padding: 15px;
  display: inline-block;
  background-color: green;
  filter: saturate(0);
  box-shadow: 0px 0px 0px #888888;
  transition: transform 0.2s, filter 0.5s, box-shadow 0.2s;
  border-radius: 10px;
}

div a:hover {
  background-color: green;
  filter: saturate(100%);
  box-shadow: 5px 5px 5px #888888;
  border-radius: 10px;
  transform: scale(1.1);
}
<div>
  <a href="#">Sample</a>
</div>

  • Related