css3实现正六边形图片+悬停效果

2017-11-26    分类:前端    标签:style    阅读:666


html代码

<div class="boxF pic1">
        <div class="boxS">
                <div class="boxT" style="background-image: url(1.jpg);">
                     <div class="overlay">
                          <a>正六边形</a>
                      </div>
                 </div>
         </div>
 </div>


css代码

  .lineF, .lineS
        {
            position: absolute;
            visibility: hidden;
        }
        .lineS
        {
            top: 182px;
            left: 105px;
        }
        .boxF, .boxS, .boxT, .overlay
        {
            width: 240px;
            height: 290px;
            overflow: hidden;
        }
        .boxF, .boxS
        {
            visibility: hidden;
        }
 .boxF
        {
            transform: rotate(30deg);
            float: left;
            margin-left: 10px;
            -ms-transform: rotate(30deg);
            -moz-transform: rotate(30deg);
            -webkit-transform: rotate(30deg);
        }
        .boxS
        {
            transform: rotate(-60deg);
            -ms-transform: rotate(-60deg);
            -moz-transform: rotate(-60deg);
            -webkit-transform: rotate(-60deg);
        }
        .boxT
        {
            transform: rotate(30deg);
            background: no-repeat 50% center;
            background-size: 100% auto;
            -ms-transform: rotate(-60deg);
            -moz-transform: rotate(-60deg);
            -webkit-transform: rotate(-60deg);
            visibility: visible;
        }
        .overlay
        {
            transition: all 250ms ease-in-out 0s;
            display: none;
            position: relative;
        }
        .overlay:hover
        {
            background-color: rgba(0,0,0,0.6);
            cursor: pointer;
        }
        .boxT:hover .overlay
        {
            display: block;
        }
        .overlay a
        {
                 transform: rotate(90deg);
                 display: block;
            /*display: inline-block;*/
            position: absolute;
            left: 14%;
            top: 45%;
            text-align: center;
            width: 220px;
            height: 32px;
                        line-height: 35px;
            color: White;
            font-size: 24px;
            font-weight: normal;
        }


【腾讯云】云产品限时秒杀,爆款1核2G云服务器,首年99元 618年中云钜惠大促,精选云产品1折起,助力新基建,618年中大促云服务器88元

‘简忆博客’微信公众号 扫码关注‘简忆博客’微信公众号,获取最新文章动态
转载:请说明文章出处“来源简忆博客”。http://www.tpxhm.com/fdetail/46.html

×
觉得文章有用就打赏一下文章作者
微信扫一扫打赏 微信扫一扫打赏
支付宝扫一扫打赏 支付宝扫一扫打赏

文章评论(0)

登录
头像

简忆博客
仕而优则学,学而优则仕。

置顶推荐

打赏本站

如果你觉得本站很棒,可以通过扫码支付打赏哦!
微信扫码:你说多少就多少~
微信扫码
支付宝扫码:你说多少就多少~
支付宝扫码
×