Responsive grid of hexagons

后端 未结 9 578
礼貌的吻别
礼貌的吻别 2020-11-22 09:30

I loaded in multiple images on my website from the internet. Is it possible to give all those images an hexagon shape in a responsive grid?

         


        
9条回答
  •  灰色年华
    2020-11-22 09:45

    TRY THIS FIDDLE

    http://jsfiddle.net/ku860uoh/

    CSS

    BODY {
        background: url(http://placekitten.com/600/600);
    }
    .hex {
        overflow: hidden;
        visibility: hidden;
        -webkit-transform: rotate(120deg);
        -moz-transform: rotate(120deg);
        -ms-transform: rotate(120deg);
        -o-transform: rotate(120deg);
        transform: rotate(120deg);
        cursor: pointer;
        }
    .images1{
        overflow: hidden;
        width: 100%;
        height: 100%;
        -webkit-transform: rotate(-60deg);
           -moz-transform: rotate(-60deg);
            -ms-transform: rotate(-60deg);
             -o-transform: rotate(-60deg);
                transform: rotate(-60deg);
        }
    .images2{
        width: 100%;
        height: 100%;
        background-repeat: no-repeat;
        background-position: 50%;
        background-image: url(http://placekitten.com/238/240);
        visibility: visible;
        -webkit-transform: rotate(-60deg);
           -moz-transform: rotate(-60deg);
            -ms-transform: rotate(-60deg);
             -o-transform: rotate(-60deg);
                transform: rotate(-60deg);
        }
    .images2:hover {
        background-image: url(http://placekitten.com/440/242);
        }
    
    .one {
        width: 400px;
        height: 200px;
        margin: 0 0 0 -80px;
        }
    .two {
        width: 200px;
        height: 400px;
        margin: -80px 0 0 20px;
        }
    

提交回复
热议问题