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 trialTiger Wang
26,548 PointsThe background-size value 'cover' doesn't work if I write it in shorthand way.
If I write it like below
background: url('../img/mountains.jpg') center no-repeat #ffa949 cover;
The image just disappeared, and when I inspect it in Chrome Dev Tool, it shows a yellow exclamation mark icon.
and it works good if I change it to
background: url('../img/mountains.jpg') center no-repeat #ffa949;
background-size:cover;
I just wonder if the background-size is the only property which can not be used in a shorthand way.
1 Answer
Tiger Wang
26,548 PointsSorry guys, I missed something from the video, so silly. It should be:
background: #ffa949 url('../img/mountains.jpg') no-repeat center /cover;
But still weird, why do we need a / to separate it.