Results 1 to 10 of 10

Thread: Scalable Background Images

  1. #1
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default Scalable Background Images

    Several folks have been asking about Scalable Background Images. I and others have been saying this is impossible. Technically that is true but, in IE this worked out:

    Code:
    <style type="text/css">
    body {
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/dahlin/curlyansp.png', sizingMethod='scale');
    background-color:#000000;color:#eee4ee;
    height:94%;
    }
    </style>
    Here is a demo. IE only and best with a crisp uncomplicated image.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #2
    Join Date
    Nov 2005
    Posts
    132
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I found this resource in relation to the image scaling.
    http://www.bigbaer.com/css_tutorials...l.tutorial.htm

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    But it isn't a background image.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Nov 2005
    Posts
    132
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Yeah, but I found it helpful and it is along the same lines.

  5. #5
    Join Date
    Nov 2005
    Posts
    132
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    ok, I'm quite interested in this concept...
    This has a scaled bg image but it's not particularly pretty..
    http://webwiz.sitetechnique.com/scal...background.htm

    I'll be quiet now .

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    But it's still an <img>, not a background image
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by neilkw
    ok, I'm quite interested in this concept...
    This has a scaled bg image but it's not particularly pretty..
    http://webwiz.sitetechnique.com/scal...background.htm

    I'll be quiet now .
    Works in Opera but, in FF and IE, when the window gets narrow in proportion to its height, white space appears at the bottom. A promising effect, I will take a look at the code and markup later.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    After looking at this a bit more, I think Opera should be left to use this (from previous post) method. IE should have the 'background' division's style set to display:none and use the filter method I outlined. That leaves FF. The problem there (and with IE if the filter method is not used for it) is that the browser just doesn't get height:100% so sets the height of the image as the image's native aspect ratio in relation to the browser's width. This makes the bottom of the image get cut off in certain situations and makes white space appear at the bottom in others. I think I would use a script to set the image's height to the value of window.innerHeight. I would do this onload and onresize but, as this is script, I would only do it in browsers that support that method and that are not Opera. Leaving Opera to scale the image using only the markup (which it seems quite capable of doing) and IE to employ its filter.
    Last edited by jscheuer1; 03-28-2006 at 05:56 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I played around with this a bit and came up with this x-browser demo. It uses no javascript, and the style has been simplified from the previous demo of neilkw, except for the addition of some IE only style. Since I am using the filter method for IE, some (documented in the source) adjustments were made for other browsers. The foreground division can be treated as the second or actual 'body', as it is in the normal flow of the page. The background is fixed and scales to fit the window size in real time.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I thought I should add that in Opera, during resizing, the layout can sometimes jump about and even get stuck out of alignment until a refresh or further resizing (making the foreground absolute fixes this and will have little consequence I believe). The actual image canvas is padded on the right to compensate for IE's tendency to cover a portion of it with the scrollbar. This necessitated some fine tuning for other browsers. OR, separate images could be used.

    /EDIT: I've just updated the demo to fix this Opera problem.
    Last edited by jscheuer1; 03-28-2006 at 11:05 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •