Go Premium for a chance to win a PS4. Enter to Win


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

Posted on 2014-11-10
Medium Priority
Last Modified: 2014-11-10
CSS How do I make my css file make any image in a table a certain size?
Question by:padmasambhava
  • 3
  • 2
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40433831
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 Comment

ID: 40433847
I cannot put it inline. Every attempt to add a width has resulted in no change.
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40433884
Then you need to give us a link to check out your page to see what is causing it.
LVL 84

Accepted Solution

Dave Baldwin earned 2000 total points
ID: 40433952
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">

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

782 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