4 replies [Last post]
stephen eighmey
Offline
newbie
atlanta
Last seen: 13 years 31 weeks ago
atlanta
Timezone: GMT-4
Joined: 2007-04-27
Posts: 2
Points: 0

is it possible to have 2 separate background images in 1 div container? e.g., in my css i have a path to an image with positioning and no-repeat set for 1 div element in my html page. this sets a background image in the bottom right of this div tag. can i set a 2nd path for another background image, positioned in the top left, in this same css selector? thank you.

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 48 weeks 6 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

stephen eighmey wrote:is it

stephen eighmey wrote:
is it possible to have 2 separate background images in 1 div container?

No.

Quote:
e.g., in my css i have a path to an image with positioning and no-repeat set for 1 div element in my html page. this sets a background image in the bottom right of this div tag. can i set a 2nd path for another background image, positioned in the top left, in this same css selector? thank you.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 46 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

As Ed says in a word no,

As Ed says in a word no, although to qualify that , you can have two backgrounds to an element in the specifications for CSS3 but so far iirc only Safari has implemented that, possibly Opera may have as they like to be ahead of the game.

Your simplest solution may be to set the second background in a div that you position absolute within the other.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

rmfred
rmfred's picture
Offline
Elder
Rock Springs, WY
Last seen: 2 years 7 weeks ago
Rock Springs, WY
Timezone: GMT-6
Joined: 2004-01-31
Posts: 1073
Points: 31

Take Hugo's suggestion

Quote:
Your simplest solution may be to set the second background in a div that you position absolute within the other.

I've done that with a header div that has a repeating bg image, then h1 and h2 tags that have bg images positioned absolutely all within the header div

stephen eighmey
Offline
newbie
atlanta
Last seen: 13 years 31 weeks ago
atlanta
Timezone: GMT-4
Joined: 2007-04-27
Posts: 2
Points: 0

thank you, i'll try that.

thank you, i'll try that.