Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    68
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Position background images

    Hello

    I am trying to get the background image images/home-middle.png to appear 186 pixels below images/home-top.png and failing!

    Code:
    .home-content { background-image: url(images/home-top.png), url(images/home-middle.png); background-repeat: no-repeat, repeat-y; background-position: 0px 0px, 0px 186px; width: 321px; height: 400px; }
    In this example images/home-middle.png seems to start 0px from the top rather than 186px from the top.

    www.burrett.net/cssissues/cssissues.html

    Can you help me?

  • #2
    New Coder
    Join Date
    Jan 2012
    Posts
    53
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by nickburrett View Post
    Hello

    I am trying to get the background image images/home-middle.png to appear 186 pixels below images/home-top.png and failing!

    Code:
    .home-content { background-image: url(images/home-top.png), url(images/home-middle.png); background-repeat: no-repeat, repeat-y; background-position: 0px 0px, 0px 186px; width: 321px; height: 400px; }
    In this example images/home-middle.png seems to start 0px from the top rather than 186px from the top.

    www.burrett.net/cssissues/cssissues.html

    Can you help me?
    i would suggest doing this istead cause with that it looks a bit way to messy.

    CSS
    Code:
    .home-top {      background: no-repeat;
                     position: absolute;
                     left: 0px; top: 0px;
                    }
    .home-middle {       background-repeat: repeat-y;
                         position: absolute;
                         left: 0px; top: 186px;
                        }
    HTML coding for the CSS only. (meaning not the whole entire html code just the part that is gonna be affected by the css)
    Code:
    <img src="images/home-top.png" class="home-top">
    <img src="images/home-middle.png" class="home-middle">
    Hope this helps and if not just say so and ill try to help you further.

  • #3
    New Coder
    Join Date
    Jun 2009
    Posts
    68
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Sorry, I forgot to add... I need to add some content to the div.

    <div class="home-content">This is where the text goes!</div>

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,678
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello nickburrett,
    That seems to work fine in FF10. You know that putting two backgrounds on one element is a CSS3 thing and not widely supported? What browser are you testing in?
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #5
    New Coder
    Join Date
    Jun 2009
    Posts
    68
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Safari

  • #6
    New Coder
    Join Date
    Jun 2009
    Posts
    68
    Thanks
    22
    Thanked 0 Times in 0 Posts
    I've just tested in Firebox too but I am still seeing home-top behind home-middle.

    If you can see any colour behind the rounded corners then it's not doing what it should be doing

  • #7
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,678
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Yes, even though you specify 186px down, repeating it on the y axis makes it repeat the entire height. It does not start at that 186px point and repeat down from there like you're thinking.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #8
    New Coder
    Join Date
    Jun 2009
    Posts
    68
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Can anyone suggest a workaround?


  •  

    Tags for this Thread

    Posting Permissions

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