我想在覆蓋圖上添加轉換,但我無法確定需要使用哪個類才能使其工作。我希望它從頂部轉換下來。沿着我將如何在div覆蓋上添加轉換
-webkit-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%);
-webkit-transition: -webkit-transform 0.3s;
transition: transform 0.3s;
HTML
<ul class="about-image">
<li>
<div class="image"></div>
<div class="overlay"><div class="bt1">Dan Morris</div><div class="bt2">Multimedia Journalist</div></div>
</li>
</ul>
CSS
.image{
height: 252px;
width: 252px;
margin-left: auto;
margin-right: auto;
margin-top: 40px;
margin-bottom: 40px;
background-image: url(../images/danmorris_profile.png);
}
.overlay{
width:252px;
height:252px;
display:none;
position:absolute;
top:40px;
left:0px;
}
.overlay div {
position:relative;
display:inline-block;
top:40px;
margin: 40px 5px 0 0;
}
ul { list-style: none; width: 252px;
margin-left: auto;
margin-right: auto;
margin-bottom: 60px;
}
ul li {
position: relative;
display: inline-block;
width: 252px;
height: 252px;
}
li:hover .overlay {
display:block;
background-color:black;
opacity:0.75;
}
.bt1 {
background-color:orange;
width:50px;
height:50px;
}
.bt2 {
background-color:green;
width:50px;
height:50px;
}
任何幫助的東西線,將不勝感激。在此先感謝
你什麼時候過渡到火災?當你懸停? – matthewelsom
另外,你可以分享的HTML或小提琴嗎? – matthewelsom
是的,目前當您將鼠標懸停在圖片上時,會出現覆蓋圖。我希望他們成爲覆蓋層的過渡。我已經將html添加到上面的代碼中。謝謝。 – iamdanmorris