Picture inserted on page:
<img src="img.jpg" alt="photo"> img { display: block; width: 100%; max-width: 500px; } The maximum image width is 500px. If we have a parent's width less than 500px, then the picture occupies 100% of the parent's width.
But it may be that the real width of the image is less than 500px.
How to limit the maximum width of a picture, if it is more than 500px, and not to stretch the picture to 500px, if the picture is smaller?
width, leave onlymax-width- Yaant