Take the pain out of building site search with the Algolia hosted API. Start free now!
Let’s do a little step-by-step of a situation where you can’t quite do what seems to make sense, but you can still get it done with CSS trickery. In this case, it’ll be applying a shadow to a shape.
You make a box
You fashion it into a nice tag shape
You use clip-path
because it’s great for that.
GRIP-LOK designed to be used with any deep switch box that has ears. GRIP-LOK supports old-work switch box installations. Simply slip the GRIP-LOK between the box and the wall and then bend the tabs into. Box empowers your teams by making it easy to work with people inside and outside your organization, protect your valuable content, and connect all your apps.
You want a shadow on it, so you…
Try to use box-shadow
.
But it doesn’t work. Nothing shows up. You think you’re going crazy. You assume you have the syntax wrong. You don’t. The problem is that clip-path
is cutting it off.
You can drop-shadow a parent element instead
There is a filter that does shadows as well: drop-shadow()
. But you can’t use it directly on the element because the clip-path
will cut it off as well. So you make a parent:
Clip Box
You can’t use box-shadow
on that parent either, because the parent is still a rectangle and the shadow will look wrong. But you can use filter
, and the shadow will follow the shape.
Clip Box Turtles Nails
See the Pen
Shadow on Shape by Chris Coyier (@chriscoyier)
on CodePen.
Sterilite Deep Clip Box
That’s all.