Page 1 of 1

background picture repeating

Posted: Mon May 09, 2005 4:25 am
by pleigh
hi there....is there a way i can control the background picture not to repeat?thnx

Posted: Mon May 09, 2005 4:33 am
by JayBird
CSS

something like

Code: Select all

background-image:url(/images/jobdesc/adwgrid.gif);
	background-repeat:no-repeat;

Posted: Mon May 09, 2005 5:58 am
by phpScott
or even in your css

Code: Select all

body{
  background:url(/images/interface/body-bg.gif) no-repeat;
}

Posted: Mon May 09, 2005 6:03 am
by Chris Corbyn
Drifting *slightly* off-topic but when using no-repeat you often wish to have control over the position of the background.

Take a wild guess which CSS atrribute does that one :P

Code: Select all

body{
  background:url(/images/interface/body-bg.gif) no-repeat;
  background-position: top left;
}
http://www.w3schools.com/css/ is a nice resource by the way ;-)

Posted: Mon May 09, 2005 6:56 am
by pleigh
the image does not load....i edit my css file and put something like this

Code: Select all

body{
  background:url(/images/dome.jpg) no-repeat;
  background-position: top left;
}

Posted: Mon May 09, 2005 7:06 am
by phpScott
is the url to the image correct?

Posted: Mon May 09, 2005 7:27 am
by pleigh
thanks...yes, the url is correct...

Posted: Mon May 09, 2005 8:06 am
by andre_c
what element are you putting the background image on?
make sure the element has enough width to show the background picture

Posted: Mon May 09, 2005 9:35 am
by onion2k
pleigh wrote:thanks...yes, the url is correct...
Are you sure? If you're using an external CSS file the path to the image needs to be relative to the CSS file, not the php script. So if your CSS is in a directory you'd need a "../" in the path..

Posted: Mon May 09, 2005 9:59 am
by JayBird
onion2k wrote:
pleigh wrote:thanks...yes, the url is correct...
Are you sure? If you're using an external CSS file the path to the image needs to be relative to the CSS file, not the php script. So if your CSS is in a directory you'd need a "../" in the path..
not if he is using root relative paths, which i think he is

Posted: Mon May 09, 2005 10:05 am
by wwwapu
Try

Code: Select all

background:url(./images/dome.jpg) no-repeat;
One dot (.) means the current directory

Posted: Tue May 10, 2005 1:29 am
by pleigh
wwwapu wrote:Try

Code: Select all

background:url(./images/dome.jpg) no-repeat;
One dot (.) means the current directory
tried this one and still not working....i tried to call the css file to another page, but it is also not working....below is my css code for body{}

Code: Select all

body {
	background-image: url(/images/table.jpg) no-repeat;
	background-position: top right;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px
}

Posted: Tue May 10, 2005 8:29 am
by vigge89
pleigh wrote:
wwwapu wrote:Try

Code: Select all

background:url(./images/dome.jpg) no-repeat;
One dot (.) means the current directory
tried this one and still not working....i tried to call the css file to another page, but it is also not working....below is my css code for body{}

Code: Select all

body {
	background-image: url(/images/table.jpg) no-repeat;
	background-position: top right;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px
}
try:

Code: Select all

body {
	background: url(&quote;/images/table.jpg&quote;) no-repeat top right;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}

Posted: Tue May 10, 2005 9:17 am
by Chris Corbyn
Well the most foolproof way instead off cramming as much into one attribute to fix an issue is to break it up and see what causing the problem.

Code: Select all

background-image: url(/images/table.jpg);
background-repeat: no-repeat;
background-position: top right;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px