Log in

View Full Version : 2 background images for single div?



hotice
11-05-2009, 02:58 PM
Hi all,
Can I use 2 background images for single div, one image will float left and other is float right?
This is my first message and I am new one here, Hope get good answer!!! :)

webboc
11-14-2009, 06:56 PM
Hi

Set one of your images on the DIV background to the required position and then set your second image using the IMG tag.

#myBackgrd { }
#myBackgrd img{ }

gurmeet
11-17-2009, 05:17 AM
u can also use nested divs for two images

.div1
{
background:url(...) top left no-repeat;
}

.div2
{
background:url(...) top right no-repeat;
}


and use the divs like this

<div class="div1">
<div class="div2">

contents.....
</div>
</div>

boogyman
11-17-2009, 06:21 PM
u can also use nested divs for two images

.div1
{
background:url(...) top left no-repeat;
}

.div2
{
background:url(...) top right no-repeat;
}


and use the divs like this

<div class="div1">
<div class="div2">

contents.....
</div>
</div>

While nested <div>'s can work, any block-level element would accomplish the same effect, without the potentially extraneous tag.



Hi all,
Can I use 2 background images for single div, one image will float left and other is float right?
This is my first message and I am new one here, Hope get good answer!!!

What exactly is the desired outcome?