stretching images

Discussion in 'CSS' started by david_sakh, Oct 19, 2004.

  1. #1
    .button {
    background-image: url("http://www.exclusivefreegames.com/images/btn80x25.jpg");
    width: 80;
    height: 25;
    valign: middle;
    }

    I want that image to stretch to fit a table cell. Can anyone please help? :(

    I want to use an image as a background for my buttons. It was working for a while but the size in CSS isn't applying to the td, so i figured my only course of action would be to stretch.
     
    david_sakh, Oct 19, 2004 IP
  2. Lever

    Lever Deep Thought

    Messages:
    1,823
    Likes Received:
    94
    Best Answers:
    0
    Trophy Points:
    145
    #2
    If you were going to stretch that image to fit the table cell, then I guess you'd have to set width: to the width of the cell not the img. However IMO that usually looks cheap, so you'd be best off designing a graphic to the exact size you want

    HTH
     
    Lever, Oct 20, 2004 IP
  3. mopacfan

    mopacfan Peon

    Messages:
    3,273
    Likes Received:
    164
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The better way to do this is to create a left and a right edge of the button and then create a filler image for the background. Use three TD's. Left side / center / Right side. Then the buttons will be fillled properly and won't look dorky from being stretched.
     
    mopacfan, Oct 20, 2004 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Stretching is pretty tough on the CPU apparently. The filler option sounds best to me.
     
    T0PS3O, Oct 20, 2004 IP
  5. david_sakh

    david_sakh Peon

    Messages:
    1,225
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #5
    best idea ive heard all day. thx a bunch.
     
    david_sakh, Oct 20, 2004 IP
  6. mopacfan

    mopacfan Peon

    Messages:
    3,273
    Likes Received:
    164
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Glad I could help. :)
     
    mopacfan, Oct 20, 2004 IP