Rolling a coke can around with pure CSS

 

Román Cortés is having a lot of fun with CSS tricks these days. He just built an example rolling CSS coke can that uses background-attachment, background-position, and a few other tricks to get the effect. No fancy CSS3 needed here!

The key pieces used:

CSS:

  1.  
  2. p {
  3.         background-image: url(coke-label.jpg);
  4.         background-attachment: fixed;
  5.         background-repeat: repeat-x;
  6.         width: 1px;
  7. }
  8.  
  9. #x1 {background-position: 5px 30px;}
  10. #x2 {background-position: 0px 30px;}
  11. #x3 {background-position: -3px 30px;}
  12. #x4 {background-position: -6px 30px;}
  13. #x5 {background-position: -8px 30px;}
  14.  

It helps to see the can and the wrapper that is placed around it.

Rolling a coke can around with pure CSS

Tags:

 
 
 

0 Comments

 

You can be the first one to leave a comment.

 

Leave a Comment

 




XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>