Answers for "transition css hover"

CSS
6

transition css hover

/* Transition is how much my element will take time to change his state 
   or apply a specific style on it at specific */
.my-div{
  background-color: #f00; /*Red*/
  transition: 3s ease-in-out;
  /* transition: .5s ease-in-out; [0.5 seconds] */
}
.my-div:hover{
  background-color: #00f; /*Blue*/
}
/* .my-div background-color will be changed from red to blue in 3 seconds*/
Posted by: Guest on June-14-2021
1

css transition opacity

/* Answer to: "css transition opacity" */

/*
  CSS transitions allows you to change property values smoothly,
  over a given duration.
*/

.myClass {
  vertical-align: top;
  transition: opacity 0.3s; /* Transition should take 0.3s */
  -webkit-transition: opacity 0.3s; /* Transition should take 0.3s */
  opacity: 1; /* Set opacity to 1 */
}

.myClass:hover {
  opacity: 0.5; /* On hover, set opacity to 2 */
}

/* 
  From `opacity: 1;` to `opacity: 0.5;`, the transition time should
  take 0.3 seconds as soon as the client starts to hover over the
  element.
*/
Posted by: Guest on April-20-2020
0

transition on hover

div {
  transition: background-color 0.5s ease;
  background-color: red;
}
div:hover {
  background-color: green;
}
Posted by: Guest on June-13-2021
2

css transition on hover

/* Simple CSS color transition effect on selector */

div {
	color: white;
  	background-color: black; 
}

div:hover {
	background-color: red;
}


/* Additional transition effects on selector */

div {
	background-color: black;
  	color: white;
  	height: 100px;
  	transition: width 1.5s, height 3s;
  	width: 100px;
  	
}

div:hover {
	background-color: red;
  	height: 300px;	
  	width: 150px;
}
Posted by: Guest on May-13-2020

Browse Popular Code Answers by Language