I was able to make the lifted corners for a DIV using CSS. Here is the jsfiddle link Here
I need to design lots of child DIVs that also have lifted corners just like the parent. How can I make this?
Ideally, you want to get your code to the point where simone's answer would work. It might take a bit of work to get to that point, though!
Your first problem stems from the fact that your drop-shadow
and lifted
classes aren't independent. You need to have a (modified) drop-shadow
class appended to any div
that you want the shadows to appear on, as you can see in this ugly JSFiddle.
However, I had to make a modification to your drop-shadow
class. What I did was get rid of the 'z-index' value on the drop-shadow:before, drop-shadow:after
selectors, which was hiding the drop-shadow on the child div
.
From this, we can see the first edit we need to make. You need to add
.lifted:after,
.lifted:before {
position: absolute;
content: "";
}
which is necessary to make the shadows visible (remember, the before
and after
pseudoelements won't display if you don't set the content
). But this isn't sufficient. The reason is because your absolute
positioning is placing the two shadows on top of one another.
Go to this JSFiddle and add/remove the lifted
class from the child div
to see what I mean.
This JSFiddle almost fixes it, but you should see this question and answer to see why it doesn't! You should be able to use that to fix your problem.
You have a .lifted
class in your jsFiddle. You can use that same class in every other div
you want.