亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

繪制漸變后 CSS 文本不會立即顯示

繪制漸變后 CSS 文本不會立即顯示

波斯汪 2023-12-25 15:49:07
我有一個奇怪的問題。這僅發生在初次翻牌時。我的文本顯示在漸變背景之上。該背景圖像在鼠標懸停時顯示。文本需要一瞬間才能顯示,然后就會彈出。當圖像翻轉時,我需要文本已經存在,或者至少有一個平滑的過渡(如果這是不可能的)。我已經追蹤到文本在圖像不同角落的位置。如果我刪除用于放置文本的 CSS,那么它會顯示并正常工作。這是 HTML<div class="flip-card">  <div class="flip-card-inner">    <div class="flip-card-front">      <img  [src]="sanitizer.bypassSecurityTrustUrl('data:'+image.mimeType+';base64, '+image.frontImage)"  alt="Avatar" style="width:300px;height:300px;">    </div>    <div class="flip-card-back linear-gradient">      <h1 class="info">{{getTitle()}}</h1>      <p class="info-bottom-right">{{getTitle()}}</p>      <p class="info-bottom-left">{{getTitle()}}</p>    </div>  </div></div>這是CSS.flip-card {  background-color: transparent;  width: 300px;  height: 200px;  border: 1px solid #f1f1f1;  perspective: 1000px; /* Remove this if you don't want the 3D effect */}/* This container is needed to position the front and back side */.flip-card-inner {  position: relative;  width: 100%;  height: 100%;  text-align: center;  transition: transform 0.8s;  transform-style: preserve-3d;}/* Do an horizontal flip when you move the mouse over the flip box container */.flip-card:hover .flip-card-inner {  transform: rotateY(180deg);  cursor: pointer;}/* Position the front and back side */.flip-card-front, .flip-card-back {  position: absolute;  width: 100%;  height: 100%;  -webkit-backface-visibility: hidden; /* Safari */  backface-visibility: hidden;}/* Style the front side (fallback if image is missing) */.flip-card-front {  background-color: #bbb;  color: black;}/* Style the back side */.flip-card-back {  background-color: dodgerblue;  color: white;  transform: rotateY(180deg);}.info{  display: block;  position: absolute;  top: 10px;  left: 10px;  color: #fff;  font-weight: bold;}.info-bottom-right{  display: block;  position: absolute;  top: 10px;  right: 10px;  color: #fff;  font-weight: bold;}.info-bottom-left{  display: block;  position: absolute;  bottom: 10px;  left: 10px;  color: #fff;  font-weight: bold;}
查看完整描述

2 回答

?
UYOU

TA貢獻1878條經驗 獲得超4個贊

事實證明,這是 Chromium 瀏覽器的一個已知錯誤 。您所要做的就是添加preserve-3d到前面和后面的類中。

.flip-card-front, .flip-card-back {

? position: absolute;

? width: 100%;

? height: 100%;

? -webkit-backface-visibility: hidden; /* Safari */

? backface-visibility: hidden;

? transform-style: preserve-3d;

}


查看完整回答
反對 回復 2023-12-25
?
揚帆大魚

TA貢獻1799條經驗 獲得超9個贊

過渡:變換0.8s;也適用于文本,因此當卡片翻轉時,它會稍微延遲文本的顯示。如果將其更改為 0.3 秒,卡片會翻轉得更快,但文本也會顯示得更快



查看完整回答
反對 回復 2023-12-25
  • 2 回答
  • 0 關注
  • 189 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號