CSS:從具有投影的 Vuetify 對話框內的 div 中刪除投影
P粉826429907
P粉826429907 2023-09-13 19:57:28
0
1
501

我有一個對話框,在 div 上使用 CSS 新增了一個三角形。但 CSS 的技巧是邊框的一部分是透明的。我試圖克服的問題是從透明邊框中刪除陰影,而不從對話框本身刪除陰影。

將其新增至 div 不起作用:

box-shadow: none;

這是我要刪除的內容的圖片:

建立這個三角形的 div 上的類別是這樣的:

.arrow-up {
  width: 0; 
  height: 0; 
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-bottom: 25px solid white;
}

然後有陰影的對話框是這樣的:

<v-dialog 
  v-model="dialog" 
  max-width="350px"
  persistent
  hide-overlay
>
<div class="arrow-up mb-n1 ml-1"></div>
  <v-card>
    <v-container>
    <v-card-text>
    <v-row>
      <v-col 
        cols="12"
        align="start"
      >
        <p class="text-subtitle-1">
        Always best to start at the beginning, let's pull your products first.</p>
      </v-col>
    </v-row>
    </v-card-text>
      
      <v-card-actions class="mt-n8">
        <v-btn
          color="#68007d"
          text
          @click="closeEverything"
        >
          CLOSE
        </v-btn>
      </v-card-actions>
    </v-container>
  </v-card>
</v-dialog>

v-dialog本身就有這個類別建立陰影

.v-dialog {
    border-radius: 4px;
    margin: 24px;
    overflow-y: auto;
    pointer-events: auto;
    transition: .3s cubic-bezier(.25,.8,.25,1);
    width: 100%;
    z-index: inherit;
    outline: none;
    box-shadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12);
}

P粉826429907
P粉826429907

全部回覆(1)
P粉401527045

要實現此目的,您需要從對話方塊中刪除框陰影並將其新增至卡片中。若要看到卡片上的方塊陰影,您需要刪除對話方塊上的溢出規則。

您可能想要將盒子陰影調整到適合的程度。

CSS:

#
.v-dialog {
  box-shadow: none;
  overflow: visible;
}

.arrow-up {
  width: 0; 
  height: 0; 
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-bottom: 25px solid white;
  position: relative;
  z-index: 1;
}

.v-sheet.v-card:not(.v-sheet--outlined) {
  box-shadow: 0px -16px 50px -1px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
}

範例: Codepen

#
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!