Results 1 to 3 of 3

Thread: Background positioning?

  1. #1
    Join Date
    Feb 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Background positioning?

    Hi! Is there any way I can position my background using "position:absolute; left:190; top:0;" If you know anything, it would really help! Thanks.

  2. #2
    Join Date
    Feb 2005
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here you can use this... I find this very very very handy whenever you want to position a background or want to stretch it.

    <html>
    <head>
    </head>
    <body style="margin: 0px; padding: 0px;">
    <div style="width: 100%; height: 100%; left: 0px; top: 0px; position: absolute; z-index: 0;">
    <img src="BACKGROUND IMAGE HERE" style="width: 100%; height: 100%;">
    </div>
    <div style="z-index: 1; position: absolute;">
    TYPE REST OF YOUR BODY HERE
    </body>
    </html>

    Hope that helps you.

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by starlingpacific
    Hi! Is there any way I can position my background using "position:absolute; left:190; top:0;"
    The position property, coupled with box offsets (top, bottom, left, and right) is for positioning elements. The background-position property allows one to offset a background image within an element.

    The property is defined as follows:

    Code:
    background-position: [percentage|length]{1,2}
                       | [[top|center|bottom] || [left|center|right]]]
                       | inherit;
    In other words, a percentage or length, or two such values:

    Code:
    background-position: 20%;
    background-position: 2px;
    background-position: 5% 10%;
    background-position: 1em 1em;
    Note: In this form, when two values are present the first is the horizontal position. If only one, the horizontal position is assumed to be 50% and the given value is the vertical position. Lengths and percentages can be mixed. Negative positions are also acceptable.

    or one or two keywords (in any order):

    Code:
    background-position: center;
    background-position: right bottom;
    background-position: top left;
    Note: If only one keyword is specified, the other is assumed to be center. The keywords top and left represent 0% on their respective axes, whilst right and bottom represent 100%. The center keyword is equivalent to 50%.

    The inherit keyword does, as always, explicitly specify that the property value should be inherited.

    The background-position property can be specified as part of the shorthand background property.

    Hope that helps,
    Mike

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
  •