DPChallenge: A Digital Photography Contest You are not logged in. (log in or register
 

DPChallenge Forums >> General Discussion >> HTML Help!!!
Pages:  
Showing posts 1 - 4 of 4, (reverse)
AuthorThread
05/14/2005 12:06:20 PM · #1
Anyone who knows HTML and can help me with what is probably a simple thing?

I'm posting an image on a website using the img tag. I want to keep the image width down to 400 pixels or less. Easy enough, I use the width attribute. But, I'd like to use the same syntax for lots of pictures, some of which might be less than 400 pixels to begin with (and I don't want to enlarge the picture).

Is there some code I can insert that will show the image at 400 pixels wide if it's bigger than that, and at actual size if it's smaller than that?

Please help!
05/14/2005 12:09:25 PM · #2
On images that are bigger then your desired size, use this code for the image tag < img src="//yourimageurl" width="desired width #" height=" desired height #">

( delete space after the first < )

On the images that are smaller then the desired width and height you need, just do not put any width or height attributed in the image tag.

Message edited by author 2005-05-14 12:09:59.
05/14/2005 12:09:53 PM · #3
You'll probably have to write javascript to set the width attribute after first examining the properties of the image.

The previous solution is the simplest unless you want to make the page code generic so adding/changing images later is as simple as possible.

Message edited by author 2005-05-14 12:14:48.
05/14/2005 12:15:20 PM · #4
The javascript thing sounds complicated, espicially for me. I guess I just go with itsrazzi's idea - I'll just specify the width if the picture is big, and I won't if it isn't.

Here's the site I'm posting these images at:

//tinypic.blogspot.com

Feel free to comment on anything weird you see there, all you web-design and HTML gurus.
Pages:  
Current Server Time: 01/05/2026 01:15:25 AM

Please log in or register to post to the forums.


Home - Challenges - Community - League - Photos - Cameras - Lenses - Learn - Help - Terms of Use - Privacy - Top ^
DPChallenge, and website content and design, Copyright © 2001-2026 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Current Server Time: 01/05/2026 01:15:25 AM EST.