0

I am trying to set css shadow for top part and also for left and right but with reduced height. I am familiar with blur/radius, but I want the shadow be really short. picture from wix template (cant upload yet, I am sorry)

Can somebody please help me? The last chance I see, I will probably use border-image but I want to avoide it, if possible. Thanks for every suggestion

4

1 回答 1

0

一种可能性,使用带有透视的伪旋转并且尺寸仅为高度的一半:

.test {
  width: 200px;
  height: 200px;
  margin: 10px;
  border: solid 1px red;
  position: relative;
  background-color: white;
}

.test:after {
  content: "";
  position: absolute;
  top: 0px;
  right: 0px;
  height: 50%;
  left: 0px;
  box-shadow: 0px 0px 15px 2px black;
  transform: perspective(400px) rotateX(-10deg);
  transform-origin: center top;
  z-index: -1;
}
<div class="test"></div>

于 2016-02-02T20:52:46.760 回答