Unit 3 ยท Read All About It
Stage 2 of 7
Unit 3 ยท Stage 2
Under the masthead, a newspaper puts one big photo to draw you in. It is called the hero image. You will add a full-width photo to your front page. (pause on a highlighted word to see what it does)
We added a <section class="hero"> with a photo inside. Right now the image sits at its natural size. You will stretch it across the whole page.
A hero image should span the full page and stay a neat shape.
width100% stretches the image across the full width of the page.height420px keeps the hero a bold, even band no matter the photo.object-fitcover fills that space and crops the extra, so the photo never looks stretched.displayblock removes the small gap browsers leave under an image..hero img rule with width: 100%;, height: 420px;, object-fit: cover;, and display: block; then press โถ Run.What object-fit value fills the box and crops the extra? Type it, then press Submit to unlock the next steps.
The photo comes from a free placeholder service. When you are ready, change the web address inside the <img> tag to a picture that fits your story.
To complete Stage 2, your hero image needs object-fit: cover and a set height. Press Check my work when you are ready. This opens Stage 3 and lets your teacher see that you finished.