CSS How do I make my css file make any image in a table a certain size?

padmasambhava
padmasambhava used Ask the Experts™
on
CSS How do I make my css file make any image in a table a certain size?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
That is normally done in the image tag, not in CSS.  To do it in CSS, you would have to give each image a unique id so you could apply the specific CSS to it.  Another way in a table with fixed cell sizes is to set the width to a percentage instead of pixels.  100% will fill the cell.

Author

Commented:
I cannot put it inline. Every attempt to add a width has resulted in no change.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
Then you need to give us a link to check out your page to see what is causing it.
Fixer of Problems
Most Valuable Expert 2014
Commented:
This is the image tag for that page:

<img id="pic" src="art/titmouse_299x375.jpg">

I realize that you are generating all that from a PHP page but you still need to set a width or a height in the image tag so the large images don't 'blow up' the page.  If you set a fixed height like 375px, then the browser will scale the image to that size.  Something like this:

<img id="pic" src="art/titmouse_299x375.jpg" height="375px">

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start Today