Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCalvin Castillo
Front End Web Development Techdegree Student 2,494 PointsHaving trouble making an image fit its container.
I am trying to make this full background-image URL ( https://4.bp.blogspot.com/-r7Pyhsy43qo/WbQSdGJDbsI/AAAAAAAAuCA/6ZFbM9XIuKQUAjzMaN99I06Y_me5VxuxgCLcBGAs/s1600/Anime%2BMecha%2BWallpaper.jpg ), fit the Header section but parts of the picture keep getting cut out, is there a way to make it fit completely?
2 Answers
William Ennals
9,441 PointsIf you want the full image you'll have to set the
"object-fit" property to "cover"
object-fit: cover
also set the width to 100% to make sure it stays in frame.
William Ennals
9,441 PointsThis isn't working for me. Per the discussion here: https://stackoverflow.com/questions/492809/when-to-use-img-vs-css-background-image I'd recommend using the html img tag to add your image and then use the css styling to make it fit. I believe the background-img property is constricting the view.
If you could send your html code as well i can give a better suggestion since I don't know how you're using this img.
Calvin Castillo
Front End Web Development Techdegree Student 2,494 PointsCalvin Castillo
Front End Web Development Techdegree Student 2,494 PointsSadly it's not working, this is the CSS I have so far