Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want background image only once

Status
Not open for further replies.

spicymango

Programmer
May 25, 2008
119
CA
I am doing something like this

Code:
body {
background: transparent url(back.gif)  center top;
}

My image is size of my page 760px/1100

But i want this image to come only once, not keep reprating if the length of my page is longer, how can I do that ?..
 
You can use background-repeat.

Code:
body {
background: transparent url(back.gif)  center top;
[red]background-repeat: no-repeat;[/red]
}

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
And, should you wish it to repeat left->right but not up->down, the you can use 'repeat-x' instead of 'no-repeat'.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
thanks a lot for you replies. One quick question what is the significance of "transparent" I noticed even if I take that out it does not make any difference.

I tried background-repeat: no-repeat; that completely take out the image from the background
 
Transparent defines the background colour. If it is omitted, then default colour is used (which is again transparent and that is why there's no difference). Background-repeat: no-repeat shouldn't make the image disappear, it should make the image appear once. You might need to check:

1. If the element that holds the background has any dimensions at all (it might be an empty element)
2. If you have set background-attachment to fixed there might be some browser differences in where the image is fixed.

If none of these things are your problem, you will need to give us more information (preferably a link to the page).

[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top