Tribute Page, responsively resize img relative to parent element

Tribute Page, responsively resize img relative to parent element


Tried lots of things on this and cannot get the last test to pass :weary: My image on the tribute page is nice and responsive as far as I’m aware but I keep getting the error:

The element should responsively resize, relative to the width of its parent element, without exceeding its original size.

Below that line it suggests "_ Use the “display” style property with a value of “block” forresponsive images.: expected ‘inline’ to equal ‘block’_

When I apply display: block to #img-div nothing happens? If I apply it to #image then I lose my nice and centred layout and still get the error!

The original images width is 625px so I’ve specified max-width: 625px;

anyone have any ideas???

here’s what I have so far;

Many thanks


here you go. Just use this code instead:

#image {
width: 100%;
height: auto;
max-width: 625px;
margin-left: auto;
margin-right: auto;
display: block;


Ah hbar1st your a life saver! I forgot about the margin-left: auto; and margin right: auto; trick!

Thank you so much!


does not work for me. my image is 600px and i just substituted the values. nothing changed

#image {
display: block;
max-width: 100%;
height: auto;

This should work


it did. thanks


what was the problem please?


Thais challenge explains it. Percentage scales the image to fit the width of its container.


It isn’t working.What shall I do then?:worried:


hi @ShashankShekhar,

did you manage to solve the issue? if not, what have you tried and how did it turn out?


Worked perfectly fine por me, many thanks!


Didn’t work for me. I wonder why


didnt work for me either :frowning:


You need to assign a max-width: 100% to your image and make sure its parent element has a set width too. For example the container could be 900px, if you set the image inside it to a max width of 100%, it is therefore responsive but cannot flow outside of its container.


great pretty trick… totally forgot it thanks man


use max-width: 100%; height: auto; display: block;


me too, thanks so much!