0

i am using html. in html table i have a table row inside td i have company logo.

<image src="images\some.jpg">

but displayed image size is too large. is it possible to set height and width for it?

Please help me!

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
user1016403
  • 12,151
  • 35
  • 108
  • 137

5 Answers5

2

There are width and height attributes, though it would behoove you to do a little reading up on cascading stylesheets (css).

<img src="..." width="100" height="200" alt="Company Logo"/>

You should be able to specify just the width or just the height to automatically scale the other dimension.

David
  • 19,389
  • 12
  • 63
  • 87
  • +1 I'm glad someone else noticed the use of tables for positioning. CSS is a much better option. – Aaron Dec 27 '11 at 15:07
0
<td><img src='abc.png' height='x' width='y'></td> // set x and y to integers
Johan Bezem
  • 2,582
  • 1
  • 20
  • 47
Prashant Singh
  • 3,725
  • 12
  • 62
  • 106
0

You can set the width and height attributes of the image tag, like so:

<img src="../image/path" width="100" height="100" />

Also notice that using only one of those attributes, will resize the image keeping the aspect ratio, which will prevent the image from looking distorted.

Deleteman
  • 8,500
  • 6
  • 25
  • 39
0

Yes, you can use the height and width attributes, e.g. <img src=logo.gif alt=ACME width=50 height=20>. You can also set the height and width properties in CSS.

When the width or height differs from the dimensions of the image itself, browsers rescale the image.

However, it is almost always better to scale the image in your favorite image processing program. Scaling down a large image that way lets you control the quality of the result, and it also saves bandwidth (and processing time in browsers).

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
0

Ideally you should never rely on this for your final optimized website, but you can use CSS 2's max-height and max-width to scale down an image and maintain the images aspect ratio. I have used this as a fail safe for php projects in the past when displaying user content. For example:

<style type="text/css">
.scaledimg {
max-height: 200px;
max-width: 200px;
}
</style>

<img class="scaledimg" src="imagesourcehere" />
Chaoix
  • 1,326
  • 10
  • 13