所以,我試圖在鼠標懸停在照片上時顯示一些內容。但是,我很難做到這一點,而無需移動頁面上的其他內容(如下所示)。如何在不移動頁面上的內容的情況下在懸停上顯示文本?
如何實施解決方案,在不使用margin-top: -22%
的情況下,在前3張圖片下正確顯示內容?
.eCommerce{
margin-left: 7%;
}
.photo1-content{
display: none;
}
.photo1:hover .photo1-content{
display: block;
margin-top: -22%;
margin-left: 13%;
}
.photo2-content{
display: none;
}
.photo2:hover .photo2-content{
display: block;
margin-top: -22%;
margin-left: 44%;
}
.photo3-content{
display: none;
}
.photo3:hover .photo3-content{
display: block;
margin-top: -22%;
margin-left: 75%;
}
.photo4-content{
display: none;
}
.photo4:hover .photo4-content{
display: block;
margin-top: -1%;
margin-left: 13%;
}
.photo5-content{
display: none;
}
.photo5:hover .photo5-content{
display: block;
margin-top: -1%;
margin-left: 44%;
}
.photo6-content{
display: none;
}
.photo6:hover .photo6-content{
display: block;
margin-top: -1%;
margin-left: 75%;
}
.enterprise{
position: static;
}
你可以嘗試靴子popover這個。 http://www.w3schools.com/bootstrap/bootstrap_popover.asp – Manish