...

View Full Version : Image using CSS



ningo
12-24-2005, 05:02 PM
I am using actie style sheet to change the CSS for my website. I have a different image for each CSS file chosen. What is the CSS code to specify the image path?

harbingerOTV
12-24-2005, 05:21 PM
something like:



#element {
background: #color (or transparent) url(the path to the image) background-positioning;
}


eg:


div#main {
background: #fff url(images/mainbg.jpg) top left repeat-x;
}

vinyl-junkie
12-24-2005, 06:04 PM
What harbingerOTV said, but also, if you are coding this for Firefox, define each attribute separately. For example:


div#main {
background-color: #fff;
background-image: url(images/mainbg.jpg);
background-position: top left;
background-repeat: repeat-x;
}

Bill Posters
12-24-2005, 06:13 PM
What harbingerOTV said, but also, if you are coding this for Firefox, define each attribute separately. For example:


div#main {
background-color: #fff;
background-image: url(images/mainbg.jpg);
background-position: top left;
background-repeat: repeat-x;
}


Why?
I develop in (and use) FF and invariably use the background shorthand property. I don't recall ever having any issues.

vinyl-junkie
12-24-2005, 07:14 PM
That's what I was told on another forum. If your page displays for you fine in Firefox without having to make that change, that's great.

harbingerOTV
12-24-2005, 09:12 PM
vinyl-junkie,

Weird. Have you ever had an issue with that? I haven't. My tooling on myspace is the only time I had to write it all out like that.

vinyl-junkie
12-24-2005, 09:23 PM
vinyl-junkie,

Weird. Have you ever had an issue with that? I haven't. My tooling on myspace is the only time I had to write it all out like that.
I wasn't the one that had the problem with it, but someone else in another forum. That person told me my page displayed fine in IE but not FF and told me that the way I was doing my CSS was the problem in FF. I presumed, perhaps incorrectly, that all FF pages needed to have their CSS coded that way.

ningo
12-25-2005, 04:15 AM
div#logo {
background-color: #fff;
background-image: url(images/logogreen.gif);
background-position: top left;
background-repeat: repeat-x;
}

So I've got this code. Is the html code to diplay the pic <div id=logo/> ?

mark87
12-25-2005, 04:17 AM
div#logo {
background-color: #fff;
background-image: url(images/logogreen.gif);
background-position: top left;
background-repeat: repeat-x;
}

So I've got this code. Is the html code to diplay the pic <div id=logo/> ?

<div id="logo">&nbsp;</div>

But you'd probably have to set a width and height to the div as well, and I'm not quite sure how it'd display on MySpace.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum