javascript - How to add a DIV to a DIV image with a button link?
代言
代言 2017-07-05 10:38:37
0
4
846

How to add a p to the p picture with a button link? As shown, who can give me the complete code? Thank you!

代言
代言

reply all(4)
滿天的星座

Written a simple hover effect for you
http://jsrun.net/TQYKp

html

<p class='box'>
  <p class='image'>
    <img src='http://imgsrc.baidu.com/imgad/pic/item/730e0cf3d7ca7bcbd0a1ac09b4096b63f624a83a.jpg'
    width='100%'>
  </p>
  <p class='mask'>
    <a class='link' href='#'>
      查看更多
    </a>
  </p>
</p>

css

.mask {
  background: #ff00a5;
  width: 300px;
  height: 200px;
  position: absolute;
  top: 0;
  z-index: 99;
  display: none
}

.image {
  width: 300px;
  height: 200px;
}

.box {
  position: relative;
  width: 300px;
}

.box:hover .mask {
  display: block;
}

.box:hover .link {
  width: 120px;
  height: 40px;
  display: block;
  background: #FFF;
  line-height: 40px;
  text-align: center;
  margin: 80px auto;
  color: #ff00a5
}
Ty80

The most important thing in programming is thinking, and the code implements it by itself.
The basic idea is to use position to solve this problem.

Peter_Zhu

Add a mouse move-in removal event, and put a p on the img to make it transparent when removed,

女神的闺蜜爱上我

You can do it with display. . Just move it in and out of settings

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!