Can not position background image

Discussion in 'HTML' started by Leupi, Mar 3, 2008.

  1. Leupi

    Leupi Guest

    I am trying to position a background image in a div:

    #wrapper2 {
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    min-width: 710px;
    max-width: 1000px;
    min-height: 400px;
    border: 1px solid gray;
    /*
    background-color:white;
    */
    background-image: url(images/eae3ce_tile.gif);
    background-position: 40px 220px;
    background-repeat: repeat-y;
    }

    according to the above code (I would assume) that the image would start
    40px from the left and 220px from the top. This is not the case; it is
    starting 40px from the left; however, it is starting at the very top and
    not 220px below that.

    The image is a 240px wide by 1px tall image tiled in the y axis. Any
    thoughts as to what I am overlooking? BTW, I have commented out a few of
    the other background images for clarity so the site is not quite as bad
    as it seems at the moment (although it is far from finished...)

    http://mysite.verizon.net/leupi5/

    Thanks,
    Todd
    Leupi, Mar 3, 2008
    #1
    1. Advertising

  2. Leupi

    rf Guest

    "Leupi" <> wrote in message
    news:l1Lyj.13832$ES.11898@trnddc05...
    >I am trying to position a background image in a div:
    >
    > #wrapper2 {
    > margin-top: 0;
    > margin-left: auto;
    > margin-right: auto;
    > min-width: 710px;
    > max-width: 1000px;
    > min-height: 400px;
    > border: 1px solid gray;
    > /*
    > background-color:white;
    > */
    > background-image: url(images/eae3ce_tile.gif);
    > background-position: 40px 220px;
    > background-repeat: repeat-y;
    > }
    >
    > according to the above code (I would assume) that the image would start
    > 40px from the left and 220px from the top. This is not the case; it is
    > starting 40px from the left; however, it is starting at the very top and
    > not 220px below that.


    It *has* started 220 pixels down from the top. Your trouble is that you have
    told it to repeat in the y direction and that is what it has done, repeated
    down *and* up to fill up the entire height of your div. This is what
    repeat-y does.

    --
    Richard.
    rf, Mar 3, 2008
    #2
    1. Advertising

  3. Leupi

    Leupi Guest

    rf wrote:
    > "Leupi" <> wrote in message
    > news:l1Lyj.13832$ES.11898@trnddc05...
    >> I am trying to position a background image in a div:
    >>
    >> #wrapper2 {
    >> margin-top: 0;
    >> margin-left: auto;
    >> margin-right: auto;
    >> min-width: 710px;
    >> max-width: 1000px;
    >> min-height: 400px;
    >> border: 1px solid gray;
    >> /*
    >> background-color:white;
    >> */
    >> background-image: url(images/eae3ce_tile.gif);
    >> background-position: 40px 220px;
    >> background-repeat: repeat-y;
    >> }
    >>
    >> according to the above code (I would assume) that the image would start
    >> 40px from the left and 220px from the top. This is not the case; it is
    >> starting 40px from the left; however, it is starting at the very top and
    >> not 220px below that.

    >
    > It *has* started 220 pixels down from the top. Your trouble is that you have
    > told it to repeat in the y direction and that is what it has done, repeated
    > down *and* up to fill up the entire height of your div. This is what
    > repeat-y does.
    >


    Well, that certainly makes sense. Looks like I need to take a different
    tack to accomplish this. Now that you mention it, that should have been
    obvious.

    Thanks!
    Leupi, Mar 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Werner Reiter

    Position of a table background image

    Werner Reiter, Dec 25, 2004, in forum: HTML
    Replies:
    1
    Views:
    543
    Erik Ginnerskov
    Dec 25, 2004
  2. David Graham

    background image position

    David Graham, Mar 4, 2006, in forum: HTML
    Replies:
    9
    Views:
    434
    David Graham
    Mar 6, 2006
  3. jc
    Replies:
    3
    Views:
    1,715
  4. jc
    Replies:
    1
    Views:
    1,355
    Neredbojias
    Mar 19, 2008
  5. Dj Frenzy
    Replies:
    3
    Views:
    294
    Robert
    Feb 10, 2004
Loading...

Share This Page