提问者:小点点

HTML/CSS:向剪辑添加阴影-路径不工作


我想添加阴影到我的剪辑路径,但如果我包裹它,它将消失。

下面是我想要的结果(必须把阴影放到剪辑路径上):

null

.question-card {
  background-color: silver;
  border-radius: 0.25em;
  height: 100px; 
  width: 200px;
  -webkit-box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
  -moz-box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
  box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
}

.inset {
  height: 40px;
  width: 20px;
  background-color: inherit;
  position: absolute;
  top: 40px;
  left: 208px;
  clip-path: inset(0 0 0 0);
  border-radius: 0 0.25em 0.25em 0;
}

.inset-wrap {
  filter: drop-shadow(-1px 1px 7px 0px rgba(0,0,0,0.75));
}
<div class="question-card">

    <span class="inset"></span>

</div>

null

下面是当我尝试添加阴影时的结果,为什么它会消失?:

null

.question-card {
  background-color: silver;
  border-radius: 0.25em;
  height: 100px; 
  width: 200px;
  -webkit-box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
  -moz-box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
  box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
}

.inset {
  height: 40px;
  width: 20px;
  background-color: inherit;
  position: absolute;
  top: 40px;
  left: 208px;
  clip-path: inset(0 0 0 0);
  border-radius: 0 0.25em 0.25em 0;
}

.inset-wrap {
  filter: drop-shadow(-1px 1px 7px 0px rgba(0,0,0,0.75));
}
<div class="question-card">
    <span class="inset-wrap">
        <span class="inset"></span>
    </span>

</div>

null


共1个答案

匿名用户

null

.question-card {
  background-color: silver;
  border-radius: 0.25em;
  height: 100px; 
  width: 200px;
  -webkit-box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
  -moz-box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
  box-shadow: -1px 1px 7px 0px rgba(0,0,0,0.75);
}

.inset {
  height: 40px;
  width: 20px;
  background-color: silver;
  position: absolute;
  top: 40px;
  left: 208px;
  clip-path: inset(0 0 0 0);
  border-radius: 0 0.25em 0.25em 0;
}

.inset-wrap {
  filter: drop-shadow(-1px 1px 7px 0px rgba(0,0,0,0.75));
}
<div class="question-card">
    <span class="inset-wrap">
        <span class="inset"></span>
    </span>

</div>

相关问题