Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » how to draw an image inside a table?


how to draw an image inside a table?

Reply
  #1 (permalink)  
Old 06-17-04, 01:31 PM
davidklonski davidklonski is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
how to draw an image inside a table?

Hello

Assume I have a very large image that I would like to display.
I would like to place the image inside a table cell like so:
Code:
<table width="100% height="100%">
  <tr>
   <td width="150px">
      <!-- some content -->
   </td>
   <td width="100%">
      <!-- image goes here -->
   </td>
   <td width="150px">
    <!-- some content -->
   </td>
  </tr>
</table>
Even though the cell of the image has width 100%, I wouldn't want the table to get large enough for a horizontal scrollbar to appear.
Note, that the width of the image can be potentially very large.
I would like the browser to re-render the image in such dimensions so that the image will not be distorted, and no horizontal scrollbar will appear.
This means that the width of the drawn image will be as large as possible as long as no horizontal scrollbar is needed. Of course the height needs to be calculated correctly so that the image will not be distorted.

If the original width of the image is smaller than the available width for the table, just use the original width for the image.

is that possible?
I would appreciate any help in code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-04-04, 12:16 PM
LJK LJK is offline
Newbie Coder
 
Join Date: May 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Imgs in Table

Hi -
Why don't you just get the images to the correct size in your favorite graphics editor, then use CSS to make them backgrounds for the row/cell?

In case you're not sure how to start:
-give the tr or td a class or id name
-add the style to the selector:
td.lscape{background:transparent url(images/imagename.ext) no repeat;}

[preferably an external, linked stylesheet.]

good luck,
El
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-06-04, 11:27 AM
ShadowCat ShadowCat is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
<TD background="image.gif"> always works too! I'm not sure how to go about doing what you said, but check out pageresource.com and read their tutor on Detecting Screen Resolution. You and your images :-p.

PaYcE--->
-=Shadow*Cat=-
__________________
Check out my newly launched site, XGamers-- http://xgamers.uni.cc
Don't forget to apply for affiliation!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with upload image and getting image name to db mikewooten PHP 3 05-14-04 05:52 PM
Problem with a sort table js function tdubyou JavaScript 0 05-03-04 10:19 AM
auto table resize derick_2k JavaScript 4 04-26-04 03:32 PM
need help in sorting table niyax JavaScript 1 03-24-04 04:39 AM
Newbie MySQL fccolon PHP 2 03-16-04 11:54 AM


All times are GMT -5. The time now is 08:09 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.