Home | All Questions | alt.html FAQ >

How do I stop the background image tiling?

stick it in your head

<style type="text/css">
body {
  background-image : url(thebackground.jpg);
  background-repeat : no-repeat;
}
</style>

How does one control how many horizontal and/or vertical repetitions of the image appear?

You don't. however to only repeat horizontally: background-repeat : repeat-x; or vertically: background-repeat : repeat-y;

Centering a background image

stick it in your head:

<style type="text/css">
body {
  background-image : url(thebackground.jpg);
  background-repeat : no-repeat;
  background-position : 50% 50%;
}
</style>

works with Internet Explorer, Netscape 6, Opera 5 and Mozilla. Netscape 4.x doesnt know what to do with it

To fix the background add in: background-attachment: fixed;

Recommended Resources

Discussion

Related Questions