The <img> element should responsively resize, relative to the width of its parent element

Hello guys!

I’m having a problem, I cannot resize the image responsively. What am I doing wrong?

Challenge: Build a Tribute Page

Link to the challenge:

Change your code to this:

img {
    width: 100%;
    max-width: 1000px;
    height: auto;
    margin: 0 auto;
    display: block;

You have to add width and max-width to the image selector in order to make it responsive. Also add display: block to be able to center the image using margin: 0 auto.

I hope that helps you out! :slight_smile:

1 Like

Thank you very much!!! The display block was the one missing for the code to work.


1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.