Click here to Skip to main content
15,915,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to make a pic of small size fit to the tag inside tag but the image is always is in actual pixels. any idea how to do resizing of image inside
<table><tbody><tr><td></td></tr></tbody></table>

tag.

<table width="100%">
<tr>
    <td height="90%" width="50%">
        style="background-image: removed('Album.jpg'); background-repeat: no-repeat;">
                nbsp;
    </td>
    <td width="50%">
                nbsp;
    </td>
</tr>
</table>
Posted
Updated 7-Apr-11 7:15am
v2

Image resizing is different from image display dimensions. I hope you are asking about how to display image in the custom size. An example markup would be

(in html)
<img id="MainContent_Image1" src="Test.jpg" style="height:50px;width:50px;" />

if webserver control then the markup would be

<asp:Image ID="Image1" ImageUrl="~/Test.jpg" Width="50" Height="50" runat="server" />

Which display the image 50 x 50 pixels

I understood you want the image as a background. What you can do is resize the image as shown above. Make the position absolute and place it exactly above your tag. Then set its z-index to -1000.So it act like a background. CSS3 has background-size property. Not sure the reliability of that.
 
Share this answer
 
v2
Comments
#realJSOP 7-Apr-11 14:35pm    
Setting maxwidth to 100% will scale the image down (or up) to the size of the container.
Albin Abel 7-Apr-11 15:08pm    
Yes. I got your point. But I think OP asking about a fitting background image to the container and without repeat. That may not work just setting the max width property. Agreed max width has its uses
I'm not sure what you're doing there, but try setting max-width:100%.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900