Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Dec 2002
    Location
    Unknown
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Background image stretch

    ok so here's the deal, i have an image (300 x 10) that i want to have as the background image but i want it to fit the width of the screen and repeat down

  • #2
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you're looking to be able to stretch it width wise but not height wise?

  • #3
    New Coder
    Join Date
    Dec 2002
    Location
    Unknown
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, it's a simple pattern so it can repeat down, but looks bad if it's stretched down

  • #4
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure if you can only stretch an image one way...

    Maybe open it in photoshop and resize it to fit width wise, then just tile it on your site?

  • #5
    New Coder
    Join Date
    Dec 2002
    Location
    Unknown
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well i want the image to be able to adjust to different sizes, i tried making just an image and stretched it across and repeated it - just to see how it looked, and it works out fine, but i don't know what to do for background

  • #6
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try this
    <img src="whatever" height="yourheight" width="yourwidth" name="img0">
    <script type="text/javascript">
    document.body.background = document.images['img0']
    </script>
    it might not work because it is looking for the source attribute of the image, but you could at least try.

  • #7
    New Coder
    Join Date
    Dec 2002
    Location
    Unknown
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but i don't want to set the size, i want it to fit to the width and repeat like a normal image for the height

  • #8
    [m]
    [m] is offline
    New Coder
    Join Date
    Nov 2002
    Location
    Virginia, USA
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    as far as I know there is no way to streach the bg image to fit only one side..I may be wrong cuz I'm no expert
    Last edited by [m]; 12-15-2002 at 06:00 AM.
    .:mike:.

    I'm a newbie

  • #9
    New Coder
    Join Date
    Dec 2002
    Location
    Unknown
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    that made the image repeat properly down the right side of the screen, but not stretch

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,646
    Thanks
    1
    Thanked 0 Times in 0 Posts
    There is no stretching in css. They've wanted to add background-stretch and background-size=100% for quite some time but haven't. Background-position is just that. This can only be done with javascript.
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">

  • #11
    New Coder
    Join Date
    Dec 2002
    Location
    Unknown
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok i'll go next door to ask the java script forum
    Ego Sum Deus


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •