Skip to navigation

CSS transition timing functions

Handling acceleration and deceleration of animated transitions.


<!DOCTYPE html>
	<meta charset="utf-8">
	<title>CSS transitions: Timing functions</title>
		* {
			padding: 0;
			margin: 0;
		body {
			font: 15px arial, helvetica, sans-serif;
			text-align: center;

		h1 {
			margin-top: 20px;
			color: #06c;

		li {
			list-style: none;
			margin: 20px 0;
			background: #def;
		li a {
			display: block;
			width: 300px;
			padding: 20px 0;
			background: #06c;
			color: white;

		#timing1 {
			-webkit-transition: 1s;
			transition: 1s;
		#timing2 {
			-webkit-transition: 1s linear;
			transition: 1s linear;
		#timing3 {
			-webkit-transition: 1s ease-in;
			transition: 1s ease-in;
		#timing4 {
			-webkit-transition: 1s ease-out;
			transition: 1s ease-out;
		#timing5 {
			-webkit-transition: 1s ease-in-out;
			transition: 1s ease-in-out;
		#timing6 {
			-webkit-transition: 1s cubic-bezier(0.5,0.25,0,1);
			transition: 1s cubic-bezier(0.5,0.25,0,1);
		#timing7 {
			-webkit-transition: 1s cubic-bezier(0.5,1.5,0.5,-0.5);
			transition: 1s cubic-bezier(0.5,1.5,0.5,-0.5);
		#timing8 {
			-webkit-transition: 1s steps(4);
			transition: 1s steps(4);
		li a:hover {
			width: 100%;
	<h1>CSS transition timing functions</h1>
		<li><a href="" id="timing1"><code>ease</code> (default)</a></li>
		<li><a href="" id="timing2"><code>linear</code></a></li>
		<li><a href="" id="timing3"><code>ease-in</code></a></li>
		<li><a href="" id="timing4"><code>ease-out</code></a></li>
		<li><a href="" id="timing5"><code>ease-in-out</code></a></li>
		<li><a href="" id="timing6"><code>cubic-bezier(0.5,0.25,0,1)</code></a></li>
		<li><a href="" id="timing7"><code>cubic-bezier(0.5,1.5,0.5,-0.5)</code></a></li>
		<li><a href="" id="timing8"><code>steps(4)</code></a></li>

	<!-- Link back to HTML Dog: -->
	<p><a href=""><img src="" alt="HTML Dog"></a></p>


View original