- 1 year ago 122
CSS Question

Image Max Width

I want to apply

to an image, but the image ignores the given


Image overlapping


.screenshot {
max-width: 460px;
margin: 27px;

.description {
max-width: 705px;

<div class="screenshot">
<img src="" alt="App">
<div class="description">text you see in screenshot.

Answer Source

The max-width would have to be on the image.

Image elements don't care what dimensions their parent tells them--they will simply stretch the parent container to fit anyways.

Edit: for example, you can create a new rule whose selector is .screenshot img and then apply the max-width there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download