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!
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 trial
Graham DavidsonCourses Plus Student 14,966 Points
Why use box-shadow
What is the argument of using a box-shadow over using an image with a shadow as part of that image. I told my studio it was best practice but would like something a little more specific.
Jeremy Jantz6,717 Points
If it's just a single image there's usually not that big of an advantage to using a box shadow. It will generally be quicker to add the shadow using CSS and quicker to edit/tweak ongoing without having to go back and export a new image. But, like I said, with only a single image, the advantages gained are not as great.
If you're dealing with an entire page of images, or talking about a side-wide style applied to all of your images, the advantages are huge. You'll be able to quickly apply the shadow via css and style all of your images at once. If you want to tweak the shadow down the road, that's easily accomplished by editing one single line of css rather than going back to photoshop and editing/exporting hundreds of images again.
Guil HernandezTreehouse Teacher
Box shadows also do not affect the box model and page layout because they are not considered in the image's total width or height.
If you're aligning your images to a grid, for example, you might have to compensate for the shadow space if it's embedded in the image.
John Locke9,450 Points
If you ever want to change the shadow, you don't need to fire up Photoshop again: just change it in the CSS.