【问题标题】:HTML Hover Code over Image (Mailchimp Email Template)图像上的 HTML 悬停代码(Mailchimp 电子邮件模板)
【发布时间】:2022-01-21 23:18:27
【问题描述】:

enter image description here

如何在简单的 Mailchimp 电子邮件模板中的图像上输入 Hover HTML 代码?

【问题讨论】:

  • 你的意思是像this

标签: html hover mailchimp


【解决方案1】:

为了将鼠标悬停在图片上,我提供了参考代码。参考链接以获得更多理解: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>

【讨论】:

    【解决方案2】:

    你的意思是点击图片时添加href链接吗?

    例如,

    &lt;a href="https://www.html.com"&gt;&lt;img src=".jpg"/&gt;&lt;/a&gt;

    【讨论】:

      猜你喜欢
      • 2017-05-13
      • 1970-01-01
      • 2023-02-23
      • 1970-01-01
      • 2017-03-24
      • 2014-09-01
      • 1970-01-01
      • 2014-09-25
      • 2016-12-06
      相关资源
      最近更新 更多