0

I have an application that takes an unknown image via submission by the user, and places onto the website. The image is a direct link to another image.

  <img src="someimagesite.com/adasd.jpg" width="500px">

I am looking for a way such that, if an image is submitted that is less that 500px, it scales the image to its original size instead of enlarging the image to 500px. If the image is larger than 500px, it keeps it at 500px instead of enlarging it the orignal size. The solution can either be in javascript or html. I would appreciate any help on the issue. Thanks.

0

2 Answers 2

2
<img src="someimagesite.com/adasd.jpg" style="max-width: 500px;">
Sign up to request clarification or add additional context in comments.

Comments

1

CCS can handle this. Use max-width: 500px;

1 Comment

max-width is finicky in some versions of IE. Just be careful if IE is your target platform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.