Skip to content

Instantly share code, notes, and snippets.

@anonymoussc
Last active August 29, 2015 14:25
Show Gist options
  • Save anonymoussc/f921291d7c982002958e to your computer and use it in GitHub Desktop.
Save anonymoussc/f921291d7c982002958e to your computer and use it in GitHub Desktop.
CSS3 transitions

##CSS3 transitions

CSS Transitions allows property changes in CSS values to occur smoothly over a specified duration.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc. - http://dev.w3.org/csswg/css-transitions/

<!DOCTYPE html>
<html>
<head>
<title>Transitions</title>
<link href="style.css" rel="stylesheet"/>
</head>
<body>
<div class="cssanimation">
cssAnimation
</div>
<div class="cssAnimationTimesOneLine">
cssAnimationTimesOneLine
</div>
<div class="cssanimationEasing">
cssAnimationEasing
</div>
</body>
</html>
// Code goes here
.cssanimation {
width : 200px;
border : 1px solid black;
transition-property : width;
transition-duration : 2s;
}
.cssanimation:hover {
width : 400px;
}
.cssanimationOneline {
transition : width 2s;
}
.cssanimationTimes {
transition-property : width, background-color;
transition-duration : 2s, 10s;
}
.cssAnimationTimesOneLine {
width : 100px;
background-color : white;
transition : width 2s, background-color 10s;
}
.cssAnimationTimesOneLine:hover {
width : 200px;
background-color : #FF0099;
}
.cssanimationEasing {
width : 200px;
background-color : black;
transition-property : all;
transition-timing-function : ease;
transition-duration : 2s;
}
.cssanimationEasing:hover {
background-color : #FF0099;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment