2017-02-22 107 views

回答

1

您可以使用以下屬性:

.item:hover img { 
    -moz-transform: scale(2.0); 
    -webkit-transform: scale(2.0); 
    transform: scale(2.0); 
} 

這將使放大效果的圖像上時,它懸停在。 您可以改變參數以達到所需的效果。

0

你可以看看這個,它類似於你想要的東西:

div { 
 
    height: 100px; 
 
    width: 100px; 
 
    overflow: hidden; 
 
    position: relative; 
 
} 
 
p { 
 
    background-color: black; 
 
    text-align: center; 
 
    position: absolute; 
 
    top: 0; 
 
    bottom: 0; 
 
    left: 0; 
 
    right: 0; 
 
    margin: 0; 
 
    color: white; 
 
    line-height: 100px; 
 
} 
 
img:hover { 
 
-moz-transform: scale(2.0); 
 
    -webkit-transform: scale(2.0); 
 
    transform: scale(2.0); 
 
} 
 
img { 
 
    height:100px; 
 
    width: 100px; 
 
    transition: all .2s ease-in-out; 
 
    opacity: 0.5; 
 
}
<div> 
 
    <p>Text</p> 
 
    <img src="https://placeimg.com/640/480/any"> 
 
</div>

+0

好吧,這是偉大的:d,我怎麼可以添加一個文本?例如懸停部分的「lorem ipsum」?就像這個頁面:) – Atomix

+0

@Atomix更新了文本的代碼 – Masoud