Image Stretching

Discussion in 'HTML' started by Lee Harris, Oct 27, 2003.

  1. Lee Harris

    Lee Harris Guest

    Imagine if I had a banner graphic for going across the top of my page in a
    div, but I want it to be 100% of the window, whatever the resolution (so I
    would probably go for a 1024*150 banner image), ie if anyone had a 1280
    display, the image would still just appear once without repeating or tiling,
    or having any blank space to the right of it.

    is it possible to specify 100% as an image width?
    Lee Harris, Oct 27, 2003
    1. Advertisements

  2. Lee Harris

    David Graham Guest

    You could start by removing the default padding and margin from the body

    body {margin: 0; padding: 0;}

    Then I would put your image in a div as the divs background and colour the
    divs background a colour that complemts the image in the background of the
    div. If the window resolution is very high and/or the window is wide, then
    a bit of the background colour will show - which is better than white.
    Minimise this by having a background image with a very big width. Even so,
    don't forget the no repeat value as this image is not supposed to tile under
    any circumstances.
    David Graham, Oct 27, 2003
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.