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 trialMichael Poling
Full Stack JavaScript Techdegree Student 1,847 Pointsbackground-size: cover; vs background-size: 100%;
Hey everyone,
I have a question about
background-size: cover;
vs
background-size: 100%;
Do these commands do the same thing? Or is there a difference?
Thanks!
1 Answer
Ezra Syska
1,206 PointsThank you this also confused me.
Fredrik Rönnehag
2,342 PointsFredrik Rönnehag
2,342 Pointscover = Scales the image to be large enough until the background area is completely covered by the image. Some parts of the image may not be in view within the area.
100% = Fills the area but all of the image is visible. It might screw with proportions though.
You can check an example here, https://www.w3schools.com/cssref/playit.asp?filename=playcss_background-size&preval=cover
Also more information about the css background-size, https://www.w3schools.com/cssref/css3_pr_background-size.asp