How to make the background stationary?

Discussion in 'HTML' started by Bruce W...1, Nov 5, 2003.

  1. Bruce W...1

    Bruce W...1 Guest

    I've seen number of websites where the background image doesn't move
    when you scroll down the page. Just the content scrolls. How is this
    done?

    Thanks for your help.
    Bruce W...1, Nov 5, 2003
    #1
    1. Advertising

  2. Bruce W...1 wrote:
    > I've seen number of websites where the background image doesn't move
    > when you scroll down the page. Just the content scrolls. How is this
    > done?


    Sorry, my crystal ball is broken so I can't look at the source of those
    websites and tell you!


    But they just might have used CSS, background-attachment:fixed. See
    <http://www.w3.org/TR/CSS2/colors.html#propdef-background-attachment>


    Matthias
    Matthias Gutfeldt, Nov 5, 2003
    #2
    1. Advertising

  3. Bruce W...1

    Richard Guest

    Bruce W...1 wrote:

    > I've seen number of websites where the background image doesn't move
    > when you scroll down the page. Just the content scrolls. How is this
    > done?


    > Thanks for your help.


    As CSS definition.

    body{background:url("image.jpg") fixed no-repeat;
    background-position:center;}

    or

    body {background-image:url("imagename.jpg");
    background-attachment:fixed;
    background-repeat:no-repeat;
    background-position:center; }

    URL will be the full path of the image within the ( ). Do not change "URL",
    that is required as is.
    Position can be "top left right bottom center" or combination of two.
    "center" by itself places the image in the physical center of the page while
    "top center" would place it at the top center of the page.
    Richard, Nov 5, 2003
    #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. DaveF

    stationary datagrid header

    DaveF, May 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,008
    Ken Cox [Microsoft MVP]
    May 20, 2004
  2. Bosconian
    Replies:
    1
    Views:
    1,369
    Bosconian
    May 9, 2006
  3. JohnE
    Replies:
    1
    Views:
    589
    Alexey Smirnov
    Apr 15, 2010
  4. Jeremy Chapman

    Scrollable grid with stationary foxed rows/columns

    Jeremy Chapman, Jul 29, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    4
    Views:
    132
    Jeremy Chapman
    Jul 29, 2003
  5. Curmudgeon

    Need stationary gif (banner)

    Curmudgeon, Dec 9, 2008, in forum: Javascript
    Replies:
    8
    Views:
    154
Loading...

Share This Page