Log in

View Full Version : Simple question



TimFA
04-18-2007, 06:40 AM
I want the code to make a NON-repetitive background image, I know its simple...I just completely forgot how. :D

codeexploiter
04-18-2007, 07:17 AM
.yourclassname
{
background-image: url(yourimagename.extension);
//remember to give the path information of your image file along with the image name.
}


example:


.bg
{
background-image: url(images/bg.gif);
}

TimFA
04-18-2007, 07:25 AM
Thanks Code Exploiter.

nwalton
04-18-2007, 03:50 PM
You may also want to add the no-repeat value after the URL:


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

boogyman
04-19-2007, 04:57 PM
selector {
background-image: url("url_to_image");
background-repeat: no-repeat;
background-position: vertical horizontal;
}

if you want to put it in a certain place in relation to the selector position.




background-image: url(images/bg.gif) no-repeat;
Is syntactically incorrect.. if you wish to use the shorthand method you will need to use different syntax



background: url("url_to_image") no-repeat;



now if you wanted to add in the position, you just add to the end



background: url("url_to_image") no-repeat 50% 100%;


to see a tutorial on the entire background property, visit http://w3schools.com/css/css_background.asp

mburt
04-19-2007, 06:58 PM
selector {
background-image: url("url_to_image");
background-repeat: no-repeat;
background-position: vertical horizontal;
}
Could be easily combined:

background:url() no-repeat (y,x);

techno_race
04-20-2007, 01:13 AM
I just completely forgot how.
That happens to me all the time, and I don't like to try to find the instructions again :)

TimFA
05-08-2007, 04:05 AM
Same here. I'm just glad there are soooo many people here willing to help.