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 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inserting images to fit into table cells?

    Hi everyone,

    I was wondering if anybody could help me to be able to properly "fit" a few jpg/gif images into a 5x6 table with each image in one cell but I want to keep the table's shape fixed with all the images been nicely fit into the cells without resizing the cells that is to stretch images to fit table cells.

    To be clear, I've took a snapshoot of what I currently have below:

    http://i693.photobucket.com/albums/v...t_012/test.jpg

    and I want to see something like (see the middle of the page) :

    http://www.biriz.biz/

    How can I do this, I already tried a couple things
    1. by using 100% for the image size,
    2. putting the images into the cell's background.

    But it doesn't work for me,

    Any help is greatly appreciated ....

    Thanks,
    Last edited by lana2000; 02-27-2009 at 01:51 PM.

  • #2
    Regular Coder Donkey's Avatar
    Join Date
    Sep 2003
    Location
    Blackfield UK
    Posts
    312
    Thanks
    1
    Thanked 36 Times in 36 Posts
    You should change the size of the images so that they fit the table cell size you want.
    " 90% of everything is crud" - Theodore Sturgeon
    Filthy Beast - a 60's Rock Band

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Donkey View Post
    You should change the size of the images so that they fit the table cell size you want.
    You mean changing the size of the actual images manually? if so then yes, that would work, or perhaps you mean to changing the size in the html-code which still work fine, however I was thinking if there is a way to fix the width and height of the table which that may force the contents of the cells to re-size itself dynamically to fit into the table's cells on-fly but I am not sure if such thing is exist at all.

    I guess I am just too lazy to re-size all the images manually ....

  • #4
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    You either have to restrict the width/height of the table cell or of the image. A table cell will grow to the specified size of the content or the restricted size given it.
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • #5
    New Coder
    Join Date
    Feb 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jerry62704 View Post
    You either have to restrict the width/height of the table cell or of the image. A table cell will grow to the specified size of the content or the restricted size given it.
    Should I specify the width & height for each individual cell ? perhaps you mean something like
    <td width="N-px" height="M-px"><img src="image.jpg"></td>
    I will try this, but if all the cells are of the same width N and the same height M then is there a way to just specify this N & M once in the main table and in this case we do not have to specify this for each individual cell.

  • #6
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    If you have 3 cells across the page, they will all be as large as the largest one. If you want them to all be the same size regardless, then put a width and height on the img. Your syntax is off, but I'm assuming it was just a short hand thing.

    css:
    td { width:xxpx; height:yypx;}
    and / or
    img {width:xxpx; height:yypx;}

    You know how to put that css in the header section or in a style sheet?

    If you are going to use tables, you are going to include all the accessibility tags tables need, right?
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls


  •  

    Posting Permissions

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