Curtain Effect Using Multiple Background Images


/ Published in: CSS
Save to your folder(s)

Each image is positioned, dimensioned, and repeated according to the comma separated values in the other background properties. The images in the list are layered front to back in the same order they are listed in the rule declaration. If a background color is specified it will be the bottom layer.


Copy this code and paste it in your HTML
  1. #curtains {
  2. transition-property:background-position;
  3. transition-duration:2s;
  4. transition-timing-function:ease-out;
  5. border:1px solid blue;
  6. text-align:center;
  7. font-size:200%;
  8. font-weight:bold;
  9. color:black;
  10. width: 400px;
  11. height: 300px;
  12. margin:auto;
  13. background: url(../images/curtains-left.jpg) 0px 0px no-repeat,
  14. url(../images/curtains-right.jpg) right top no-repeat,
  15. url(../images/sunrise.jpg) left top repeat-x;
  16. }
  17. #curtains:hover {
  18. transition-property:background-position;
  19. transition-duration:2s;
  20. transition-timing-function:ease-out;
  21. color:white;
  22. background-position: -201px 0px, 450px 0px, left top;
  23. }

URL: http://coboldinosaur.com/pages/CSS_Background_Images.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.