【问题标题】:how to set a background-image clickable only at particular section in javascript如何在javascript中设置仅在特定部分可点击的背景图像
【发布时间】:2017-06-24 18:16:47
【问题描述】:

“Start Free Trail”部分应该是可点击的,我也想为它添加光标指针

【问题讨论】:

标签: javascript css


【解决方案1】:

很简单,你甚至不需要 js:

.img {
  position: relative;
  max-width: 650px;
  max-height: 229px;
}
.img a { 
  z-index: 2;
  background-color: rgba(0,0,0,0.0);
  min-width: 230px;
  min-height: 34px;
  max-height: 34px;
  position: absolute;
  top: 184px;
  left: 34px;
  border-radius: 8px;
}
.img a:hover {
  background-color: rgba(0,0,0,0.1);
}
<div class="img">
  <a href="test.html"></a>
  <img src="https://i.stack.imgur.com/9caWD.jpg">
</div>

【讨论】:

    猜你喜欢
    • 2022-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多