Results 1 to 4 of 4

Thread: 2 background images for single div?

  1. #1
    Join Date
    Nov 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile 2 background images for single div?

    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!!!

  2. #2
    Join Date
    Nov 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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{ }

  3. #3
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    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>

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by gurmeet View Post
    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.

    Quote Originally Posted by hotice
    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?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •