This works great:
<style type="text/css">
div
{
width:100px;
height:100px;
background:red;
transition:width 2s;
-moz-transition:width 2s; /* Firefox 4 */
-webkit-transition:width 2s; /* Safari and Chrome */
-o-transition:width 2s; /* Opera */
}
div:hover
{
width:300px;
}
</style>
But does anyone know of a way to do this using click instead of hover? And not involving JQuery?
Thanks!
You can write like this:
CSS
input{display:none}
.ani
{
width:100px;
height:100px;
background:red;
transition:width 2s;
-moz-transition:width 2s; /* Firefox 4 */
-webkit-transition:width 2s; /* Safari and Chrome */
-o-transition:width 2s; /* Opera */
display:block;
}
input:checked + .ani{width:300px;}
HTML
<input type="checkbox" id="button">
<label class="ani" for="button"></label>
Check this http://jsfiddle.net/nMNJE/