Image questions

Hi! I have two questions: 1. Why doesn't my .image1 and img-box3 / image3 center the container when I put margin: 0 auto; on them? 2. Why doesn't the background image show up on the .background selector? https://codepen.io/amarlong/pen/BaVxojb
5 Replies
Mannix
Mannix2y ago
img is an inline element so that trick won't work don't know much about the picture element as for the .background check your css you are missing ; to make it work 😉 and your url is wrong 🙂
Å Marlon G
Å Marlon G2y ago
Fantastic! I think I fixed it now. Those pesky semicolons ... 🧐 Could i ask you one more question then. Why is the fit of the .background image so different from the .image3? Obviously image3 changes with the orientation, but when it's portrait so much more of the image is in the frame than .background.
Mannix
Mannix2y ago
object-fit doesn't do anything on the .background you want to use background-size instead
Å Marlon G
Å Marlon G2y ago
Brilliant! So take away lesson: Background is background for a reason. Thank you very much! 🙌
Mannix
Mannix2y ago
np 😉