Solved

Stop resizing table cell

Posted on 2008-10-22
2
696 Views
Last Modified: 2008-11-09
I have a table cell with 200px height 200px. How can prevent this cell from resizing even if an image with bigger size than the table cell is inserted?  I have only one row and one cell only in the cell.

ayha
0
Comment
Question by:ayha1999
2 Comments
 
LVL 8

Expert Comment

by:ccpjc
ID: 22779271
<td width=200px height=200px>
[img]
</td>
0
 
LVL 8

Accepted Solution

by:
eszaq earned 30 total points
ID: 22780330
ccpjc: you are wrong. Tables do not shrink to the size  of contents if width is specified in html, but they still do stretch if contents does not fit otherwise. Just test your solution to see the result
<table border=2>
<tr><td width=200px height=200px>
<img src="xxx.gif" alt="here" width="500" height="400" border="1">
</td></tr>
</table>

The question is: what needs to be done? Can desired result be achieved by using background-image instead of placing i<mg> inside <td>?
<td background="xxx.gif">your contents</td>
OR maybe resize image forcefully
<td><img src="xxx.gif" alt="here" width="200" height="200" border="1"></td>
OR add style to img tag:
<td><img src="sss.gif" alt="here" width="300" height="500" border="1" style="width:100px;height:100px;"></td>

As you see style value overrides values of HTML attribures img's height and width.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question