如何在网站上添加播放按钮覆盖

问题描述 投票:-3回答:1

我一直遇到各种播放按钮选项的问题。这次我从codepen.io/martinkrulltott/pen/xwrXwR复制了

My version

http://www.leatherspin.com/TEST.html

css button overlay playback
1个回答
0
投票

检查此解决方案添加叠加播放按钮

.video-thumbnail {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin: 30px;
}
.top-img {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin: 30px;
}
.btm-img {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin: 30px;
}
.overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  opacity: 0;
  transition: .5s ease;
  background-color: rgba(0,0,0,0.7);
  text-align:center;
  }
.top-img:hover .overlay ,.btm-img:hover .overlay {
  opacity: 1;
}
.overlay i
{
  color:#fff;
  top: 42%;
  transform: translate(-50%,0);
  position: absolute;
  font-size:50px;
 }
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" />

<div class="video-thumbnail top-img">
        <img src="http://www.leatherspin.com/Girl-in-leather-gloves-with-gun-leather-jacket-overknee-leather-boots-8.jpg" alt="Video thumbnail">
        <div class="overlay">
          <i class="fa fa-play"></i>
        </div>
</div>

<div class="video-thumbnail btm-img">
        <img src="http://www.leatherspin.com/girl-with-gun-leather-gloves-leather-pants-boots-170.jpg"                   alt="Video thumbnail">
          <div class="overlay">
            <i class="fa fa-play"></i>
          </div>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.