Helping ordinary people create extraordinary websites!
   

CSS Background Repeat Horizontally

Sunday, 27th September 2009
by Omar


I would like to use an image for the background of my content area. I would like for it to be a css background that repeats horizontally but not vertically. How can I get this to work?



Vader
Hi Omar,
The CSS needed to create a background image that doesn't repeat vertically but does horizontally is as follows:

<style>
#content {
background-image: url(/images/imagename.gif);
background-repeat: repeat-x;
}
</style>

An example of how to implement this is:

<div id="content">Your content area where you will have your CSS background scroll horizontally only</div>

Vader


Monday, 30th November 2009
Votes:
20
12

More CSS Help:
» How can I create a three column website layout in CSS?
» When to use CSS Div vs CSS Span?
» How to style content container
» Alternate style sheet for https
» How can an image be implemented inside a list?
» How to use image as textarea background using CSS?
» What are CSS sprites and how can I use them?
» How to create 3 column layout using CSS?