Skip to content

Instantly share code, notes, and snippets.

@freshcutdevelopment
Last active October 8, 2017 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freshcutdevelopment/5c36cc18086d8b8d3191bbd983fc68a2 to your computer and use it in GitHub Desktop.
Save freshcutdevelopment/5c36cc18086d8b8d3191bbd983fc68a2 to your computer and use it in GitHub Desktop.
Box color CSS transition
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Transition Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="box"></div>
</body>
</html>
.box{
width:200px;
height:200px;
background-color:blue;
-webkit-transition: background-color 0.5s ease;
-moz-transition: background-color 0.5s ease;
-o-transition: background-color 0.5s ease;
transition: background-color 0.5s ease;
}
.box:hover {
background-color: red;
cursor: pointer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment