【发布时间】:2022-01-21 23:18:27
【问题描述】:
如何在简单的 Mailchimp 电子邮件模板中的图像上输入 Hover HTML 代码?
【问题讨论】:
-
你的意思是像this
如何在简单的 Mailchimp 电子邮件模板中的图像上输入 Hover HTML 代码?
【问题讨论】:
为了将鼠标悬停在图片上,我提供了参考代码。参考链接以获得更多理解:https://www.tutorialrepublic.com/faq/how-to-change-image-on-hover-with-css.php
<!DOCTYPE html>
<html>
<head>
<style>
.container {
position: relative;
width: 50%;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #008CBA;
}
.container:hover .overlay {
opacity: 1;
}
.text {
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<img src="img_avatar.png" alt="My image" class="image">
<div class="overlay">
<div class="text">My Image</div>
</div>
</div>
</body>
</html>
【讨论】:
你的意思是点击图片时添加href链接吗?
例如,
<a href="https://www.html.com"><img src=".jpg"/></a>
【讨论】: