Quick html question
Moderator: General Moderators
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
Quick html question
Is their a way in html to set the max height and width for an image. But if the image isn't that size it does not make it fit it? It just wont let it go past the max width and height?
Sort of.
On the img tag itself, you can set height/width tags:
However, it doesnt PREVENT the image from being more than those dimensions - it simply uses a fairly crappy resize function to force it to fit into those dimensions for the display. (Meaning, the client still could be downloading a 1024x768 size image, but displaying it as 100x100.. much bandwidth loss).
It does prevent an image from breaking a pixel-perfect layout, but there are many (including me) that would argue that a pixel-perfect layout is inherently bad for a variety of reasons.
But thats how to use html to resize the image to a locked height/width.
On the img tag itself, you can set height/width tags:
Code: Select all
<img src="somefile.png" width="100" height="100">It does prevent an image from breaking a pixel-perfect layout, but there are many (including me) that would argue that a pixel-perfect layout is inherently bad for a variety of reasons.
But thats how to use html to resize the image to a locked height/width.
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
Ah. Hmm. You could instead do..pinehead18 wrote:Yeah, thats what i have been doing. What i was wanting to accomplish is not lock the image unless it reaches that widht/height see what i mean?
Code: Select all
<table>
<td>
<tr height = "200px">
<img src="somefile.png" height="100%">
</tr>
</td>
</table>I also think you could do the same with just css (and probably much better than the above hack), but I cant 'freehand' css just yet.. not that good at it yet.
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
<tr height = 50px><td align=center><img src=http://l.com/pics/$mainpic></tr></td>
That is what i have.. it dones't seem to make the pic go smaller..
Suggestions?
That is what i have.. it dones't seem to make the pic go smaller..
Suggestions?
<table>
<td align=center>
<tr height = "50px"><img src=http://l.com/pics/$mainpic>
</tr></td>
</table>
<td align=center>
<tr height = "50px"><img src=http://l.com/pics/$mainpic>
</tr></td>
</table>
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm