html - Bootstrap Rollover Div 链接

标签 html css twitter-bootstrap

我希望制作一个包含一些内容的 div,当鼠标悬停在 div 上时,div 中会出现三个链接。就像这样:

enter image description here enter image description here

我一直在 Stack 和 google 中进行搜索,但找不到使用三个不同的 ahref 标签来实现此目的的方法。

html

.container
  .col-md-4
    .pdf-thumb-box
      a(href='#')
        .pdf-thumb-box-overlay
          span.fa-stack.fa-lg
            i.fa.fa-square-o.fa-stack-2x.pdf-thumb-square
            i.fa.fa-eye.fa-stack-1x.pdf-thumb-eye
        img.img-responsive(src='http://lorempixel.com/400/300/technics/')
    .vertical-social-box

  .col-md-4
    .pdf-thumb-box
      a(href='#')
        .pdf-thumb-box-overlay
          span.fa-stack.fa-lg
            i.fa.fa-square-o.fa-stack-2x.pdf-thumb-square
            i.fa.fa-eye.fa-stack-1x.pdf-thumb-eye
        img.img-responsive(src='http://lorempixel.com/400/300/technics/')
    .vertical-social-box

  .col-md-4
    .pdf-thumb-box
      a(href='#')
        .pdf-thumb-box-overlay
          span.fa-stack.fa-lg
            i.fa.fa-square-o.fa-stack-2x.pdf-thumb-square
            i.fa.fa-eye.fa-stack-1x.pdf-thumb-eye
        img.img-responsive(src='http://lorempixel.com/400/300/technics/')

CSS

.pdf-thumb-box
  display: inline-block !important
  position: relative !important
  overflow: hidden

.pdf-thumb-box-overlay
  visibility: hidden
  opacity: 0
  transition: visibility 0s linear 0.5s,opacity 0.5s linear

.pdf-thumb-box a
  color: transparent
  &:hover .pdf-thumb-box-overlay
    visibility: visible
    opacity: 1
    transition-delay: 0s
    text-align: center
    position: absolute
    background-color: rgba(255, 0, 0, 0.58)
    color: #fff
    width: 100%
    height: 100%
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6)

.pdf-thumb-box-overlay span
  margin: auto
  position: absolute
  top: 0
  left: 0
  bottom: 0
  right: 0

最佳答案

enter image description here

> DEMO

HTML

<div id="rollover">
    <div id="container">
        <a class="link" href="#">
            <img src="http://i.imgur.com/X2faVAp.png"></a>
        <a class="link" href="#">
            <img src="http://i.imgur.com/cd4iQS1.png"></a>
        <a class="link" href="#">
            <img src="http://i.imgur.com/Ioxt4re.jpg"></a>
    </div>
</div>

CSS

#rollover {
    width: 170px;
    height: 55px;
    padding: 20px;
    background-color: #7FFFD4;
}
#container {
    opacity: 0;
    transition: opacity 0.3s linear; /* vendorless fallback */
    -o-transition: opacity 0.3s linear; /* opera */
    -ms-transition: opacity 0.3s linear; /* IE 10 */
    -moz-transition: opacity 0.3s linear; /* Firefox */
    -webkit-transition: opacity 0.3s linear; /*safari and chrome */
}
#container:hover {
    opacity: 100;
}
img {
    width: 50px;
    height: 50px;
}

关于html - Bootstrap Rollover Div 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32510613/

相关文章:

javascript - 使用 knockoutjs 分层 ul 列表崩溃

html - 如何使绝对定位元素随页面的其余部分一起移动?

css - 添加响应类后 YouTube 视频不显示

html - Bootstrap 4 动画导航栏不显示

html按钮图像适配

html - CSS:子列表中具有奇数偶数和非重复颜色的交替列表

html - td 可以在 td 里面吗

html - 我可以仅使用 html/css 将自定义滚动条绑定(bind)到某些操作吗?

html - 如何在不使用固定宽度的情况下保持 float 元素向下移动?

html - Bootstrap 3 字形 CDN