ਕਿਵੇਂ ਬਣਾਓ: ਫਲਿਪ ਕਾਰਡ
ਸਿਸਟਮ ਕੀਵੇਂ ਐੱਚਟੀਐੱਮਐੱਲ ਨਾਲ ਫਲਿਪ ਕਾਰਡ ਬਣਾਓ ਸਿੱਖੋ
ਘੱਟਨਾ ਇਸ ਚਿੱਤਰ 'ਤੇ ਪਾਓ:

ਬਿਲ ਗੇਟਸ
ਅਰਕੀਟੈਕਟ ਅਤੇ ਇੰਜੀਨੀਅਰ
ਅਸੀਂ ਉਸ ਗ਼ਰੀਬ ਨੂੰ ਪਸੰਦ ਕਰਦੇ ਹਾਂ
ਕਿਵੇਂ ਫਲਿਪ ਕਾਰਡ ਬਣਾਓ
ਪਹਿਲਾ ਕਦਮ - ਐੱਚਟੀਐੱਮਐੱਲ ਜੋੜੋ:
<div class="flip-card"> <div class="flip-card-inner"> <div class="flip-card-front"> <img src="img_avatar.png" alt="Avatar" style="width:300px;height:300px;"> </div> <div class="flip-card-back"> <h1>ਬਿਲ ਗੇਟਸ</h1> <p>ਆਰਕੀਟੈਕਟ ਅਤੇ ਇੰਜੀਨੀਅਰ</p> <p>ਅਸੀਂ ਉਸ ਨੂੰ ਪਸੰਦ ਕਰਦੇ ਹਾਂ</p> </div> </div> </div>
第二步 - 添加 CSS:
/* 翻转卡片的容器 - 设置你想要的宽度和高度。我们添加了 border 属性来演示翻转本身在悬停时会超出容器(如果您不想要 3D 效果,请删除透视图) */ .flip-card { background-color: transparent; width: 300px; height: 200px; border: 1px solid #f1f1f1; perspective: 1000px; /* 如果您不想要 3D 效果,请将其删除 */ } /* 这个容器用于定位正面和背面 */ .flip-card-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.8s; transform-style: preserve-3d; } /* 当鼠标悬停在翻转卡片容器上时,进行水平翻转 */ .flip-card:hover .flip-card-inner { transform: rotateY(180deg); } /* 定位正面和背面 */ .flip-card-front, .flip-card-back { position: absolute; width: 100%; height: 100%; -webkit-backface-visibility: hidden; /* Safari */ backface-visibility: hidden; } /* 设置正面的样式(如果图像缺失则备用) */ .flip-card-front { background-color: #bbb; color: black; } /* 设置背面的样式 */ .flip-card-back { background-color: dodgerblue; color: white; transform: rotateY(180deg); }