Background Image Tiling With CSS


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

Cascading Style Sheets allow developers to exercise greater control over background images on the Web. You can make an image tile vertically across the page, horizontally across the page, or both. Simply define the style at the top of the page, and declare in the tag.

The .vert class will tile the image vertically, the .horiz class will tile it horizontally, and the .both class will cover the screen.


Copy this code and paste it in your HTML
  1. <HTML>
  2. <HEAD>
  3.  
  4. <STYLE TYPE="text/css">
  5. .vert {background-image: url(myImage.gif); background-repeat: repeat-y;}
  6. .horiz {background-image: url(myImage.gif); background-repeat: repeat-x;}
  7. .both {background-image: url(myImage.gif); background-repeat: repeat;}
  8. </STYLE>
  9. </HEAD>
  10.  
  11. <BODY CLASS = "vert">
  12.  
  13.  
  14. </BODY>
  15. </HTML>

URL: http://www.devx.com/tips/Tip/12957

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.