Prevent an image from overflowing table size

T

tshad

I have a table with an image in it that is larger that the width and height.

<table class="dataTable" width="500px" height="400px" border="0"
cellpadding="0" cellspacing="0">
<tr height="400px" >
<td nowrap style="width:500px">
<asp:Image id="CompanyPicture" ImageUrl="\uploads\SmartCorner1.jpg"
runat="server"/>
</td>
</tr>
</table>

If the picture is 600 by 500, it goes over the size of the table.

With text, this would force it to wrap.

Isn't the table dimensions supposed to constrain the image and text to that
maximum size?

Thanks,

Tom
 
B

bruce barker

width and height are hints. to force absolute sizes you need to use a
style command. also unless you specify an overflow behavior, the image
will still be bigger than the table. you could specify a size of the
image and the browser will scale it.

-- bruce (sqlwork.com)
 
T

tshad

bruce barker said:
width and height are hints. to force absolute sizes you need to use a
style command. also unless you specify an overflow behavior, the image
will still be bigger than the table. you could specify a size of the image
and the browser will scale it.

How do you do that?

I tried making the changes to styles and I am still getting the same
problem:

<anthem:panel ID="GeoCodesDiv" Visible="true" style="position:absolute;
top:110px; left:500px; z-index:2000" runat="server">
<table class="dataTable" style="height:400px; width:500px" border="0"
cellpadding="0" cellspacing="0">
<tr style="height:400px">
<td nowrap style="width:500px">
<asp:Image id="CompanyPicture" ImageUrl="\uploads\SmartCorner1.jpg"
runat="server"/>
</td>
</tr>
</table>
</anthem:panel>

Tom
 
G

Guest

<table class="dataTable" style="height:400px; width:500px" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="overflow:hidden;width:500px;height:400px">
<asp:Image id="CompanyPicture" ImageUrl="\uploads\SmartCorner1.jpg"
runat="server"/>
</div>
</td>
</tr>
</table>
 
T

tshad

Milosz Skalecki said:
<table class="dataTable" style="height:400px; width:500px" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="overflow:hidden;width:500px;height:400px">
<asp:Image id="CompanyPicture" ImageUrl="\uploads\SmartCorner1.jpg"
runat="server"/>
</div>
</td>
</tr>
</table>

That worked great.

Are there any other options I could do with this such that it would resize
if too large but wouldn't stretch it if smaller than the table size.

Thanks,

Tom
 
G

Guest

Howdy,

Yes, there are. See my replies to topic (it should work for regular
asp:image as well):

http://www.microsoft.com/communitie...pnet&mid=d7f63eeb-e86a-4257-8fce-f3c3e2f7a618
--
Milosz


tshad said:
Milosz Skalecki said:
<table class="dataTable" style="height:400px; width:500px" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="overflow:hidden;width:500px;height:400px">
<asp:Image id="CompanyPicture" ImageUrl="\uploads\SmartCorner1.jpg"
runat="server"/>
</div>
</td>
</tr>
</table>

That worked great.

Are there any other options I could do with this such that it would resize
if too large but wouldn't stretch it if smaller than the table size.

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top