Display: block in this case didn't fill up the entire width


In the (linked) project, Task 2 is to change the width of the so that it stretches across its entire parent element. I used display: block but that didn’t work. Why is that so? I thought block is supposed to make an element fill the entire width of the page?

Thank you so much in advance! :slight_smile:

No this is not the case. Using display:block; makes sure the elements display one after the other.
Here is some documentation on this.

Task 2 says btw that you should change the width of the element.

Hope it helps. Good luck.

Hi, thanks for the response. From what I read from the documentation, it does seem to indicate that displaying items as block makes them flow in the next line.

Actually I was referring to the lesson on Display:Block in my post.


where it says that block-level elements fill the entire width of the page.

My interpretation of Task 2 was to work the css such that the resulting width of the element stretches across the entire parent by any method that works, ie it doesn’t have to be literally using the width property to do it :smile:

So my real question is, why didn’t display: block provide the same result ? :thinking: