Custom shadow with CSS

99封情书 提交于 2019-12-04 07:14:48

问题


How do I make a shadow per the image below? I don't have any idea how to do that.


回答1:


One way you can do it is by styling the pesedo elements ::before and ::after like this:

div {
  width: 300px;
  height: 400px;
  background: #FFF;
  margin: 40px auto;
  position: relative;
}

div::before,
div::after {
  z-index: -1;
  position: absolute;
  content: "";
  width: 50%;
  height: 50%;
  right: 10px;
  top: 10px;
  max-width: 300px;
  background: #777;
  box-shadow: 15px 0px 10px #777;
  transform: rotate(3deg);
}

div::after {
  transform: rotate(-3deg);
  top: calc(50% - 10px);
}
<div></div>

This see pen for more shadow styling.



来源:https://stackoverflow.com/questions/58796978/custom-shadow-with-css

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!