在所有div上方显示div(绝对定位)

时间:2016-08-06 08:54:28

标签: html css

当我点击分享按钮时,带有社交媒体图标的div(class =“soc-icons”)显示在位于下方的div后面(class =“bioDivContainer”)。

enter image description here

HTML代码

     <div class="col-md-6 col-md-offset-3 quoteDiv col-xs-12">
        <p id="quotes"></p>
        <!--end of "quotes" p-->
        <button class="btn btn-primary" id="getQuote" type="button">Get Quote</button>
        <div class="like&share pull-right">
          <span class="glyphicon glyphicon-heart social-but" data-placement="left" data-toggle="tooltip" title="Like the Quote"></span> <span class="glyphicon glyphicon-share" data-placement="left" data-toggle="tooltip" title="Share the Quote">
      <div class="soc-icons">
        <span><i class="fa fa-google-plus" aria-hidden="true"></i></span>
        <span><i class="fa fa-facebook" aria-hidden="true"></i></span>
        <span><i class="fa fa-instagram" aria-hidden="true"></i></span>
        <span><i class="fa fa-vk" aria-hidden="true"></i></span>
      </div>    
</span>
          <span><i aria-hidden="true" class="fa fa-twitter"
                        data-placement="left" data-toggle="tooltip" title=
                        "Tweet the Quote"></i></span>
        </div>
      </div>
      <!--end of "col-md-6 col-md-offset-3" div-->

CSS代码

.soc-icons {
  margin-top:20px;
  position:absolute;
  width:auto;
  z-index:10;
  height:auto;
  border:1px solid transparent;
  display:none;
  background-color:white;
}

.soc-icons span {
  display:inlnie;
}

如何使用 soc-icons 类在div下方显示div。

Codepen link

1 个答案:

答案 0 :(得分:1)

设置.quoteDiv {z-index: 1}