Use css3 to arrange image triangles. Use css3 to arrange image triangles.

Source: Internet
Author: User

Use css3 to arrange image triangles. Use css3 to arrange image triangles.

Today is an era of reading images. Images are more or less used on most web pages. Especially for webpages with many images. The layout and layout of images are very important. Today, we will bring a pure css3 in uppercase to arrange the image triangles. Suitable for a series of images. As follows:

Download Online Preview source code

Implementation code.

Html code:

 <div class='container'>        <div class='wrap'>            <div class='crop'>                            </div>        </div>        <div class='wrap'>            <div class='crop'>                            </div>        </div>        <div class='wrap'>            <div class='crop'>                            </div>        </div>        <div class='wrap'>            <div class='crop'>                            </div>        </div>        <div class='wrap'>            <div class='crop'>                            </div>        </div>        <div class='wrap'>            <div class='crop'>                            </div>        </div>        <div class='wrap'>            <div class='crop'>                            </div>        </div>        <div class='wrap'>            <div class='crop'>                            </div>        </div>    </div>

Css3 code:

 body        {            background: #f1f1fa;        }                .container        {            margin: 140px auto 0;            font-size: 0;            max-width: 560px;        }                .wrap        {            -webkit-transform: rotate(45deg) translate3d(0, 0, 0);            -moz-transform: rotate(45deg) translate3d(0, 0, 0);            -ms-transform: rotate(45deg) translate3d(0, 0, 0);            -o-transform: rotate(45deg) translate3d(0, 0, 0);            transform: rotate(45deg) translate3d(0, 0, 0);            display: inline-block;            -webkit-transition: -webkit-transform 300ms ease-out;            -moz-transition: -moz-transform 300ms ease-out;            transition: transform 300ms ease-out;            width: 100px;        }        .wrap:hover        {            -webkit-transition: -webkit-transform 700ms ease-out;            -moz-transition: -moz-transform 700ms ease-out;            transition: transform 700ms ease-out;            -webkit-transform: rotate(45deg) translate3d(10px, 10px, 0);            -moz-transform: rotate(45deg) translate3d(10px, 10px, 0);            -ms-transform: rotate(45deg) translate3d(10px, 10px, 0);            -o-transform: rotate(45deg) translate3d(10px, 10px, 0);            transform: rotate(45deg) translate3d(10px, 10px, 0);        }        .wrap:nth-child(even)        {            width: 40px;            -webkit-transform: rotate(225deg) translate3d(30px, 120px, 0);            -moz-transform: rotate(225deg) translate3d(30px, 120px, 0);            -ms-transform: rotate(225deg) translate3d(30px, 120px, 0);            -o-transform: rotate(225deg) translate3d(30px, 120px, 0);            transform: rotate(225deg) translate3d(30px, 120px, 0);        }        .wrap:nth-child(even) .crop img        {            -webkit-transform: skew(-20deg, -20deg) rotate(-225deg);            -moz-transform: skew(-20deg, -20deg) rotate(-225deg);            -ms-transform: skew(-20deg, -20deg) rotate(-225deg);            -o-transform: skew(-20deg, -20deg) rotate(-225deg);            transform: skew(-20deg, -20deg) rotate(-225deg);        }        .wrap:nth-child(even):hover        {            -webkit-transform: rotate(225deg) translate3d(40px, 130px, 0);            -moz-transform: rotate(225deg) translate3d(40px, 130px, 0);            -ms-transform: rotate(225deg) translate3d(40px, 130px, 0);            -o-transform: rotate(225deg) translate3d(40px, 130px, 0);            transform: rotate(225deg) translate3d(40px, 130px, 0);        }                .crop        {            position: relative;            width: 160px;            height: 160px;            margin: 0;            display: block;            overflow: hidden;            -webkit-transform: skew(20deg, 20deg) translate3d(0, 0, 0);            -moz-transform: skew(20deg, 20deg) translate3d(0, 0, 0);            -ms-transform: skew(20deg, 20deg) translate3d(0, 0, 0);            -o-transform: skew(20deg, 20deg) translate3d(0, 0, 0);            transform: skew(20deg, 20deg) translate3d(0, 0, 0);        }        .crop img        {            width: 160px;            height: 160px;            position: absolute;            left: -50%;            margin-top: 36px;            margin-left: 36px;            top: -50%;            -webkit-transform: skew(-20deg, -20deg) rotate(-45deg);            -moz-transform: skew(-20deg, -20deg) rotate(-45deg);            -ms-transform: skew(-20deg, -20deg) rotate(-45deg);            -o-transform: skew(-20deg, -20deg) rotate(-45deg);            transform: skew(-20deg, -20deg) rotate(-45deg);            opacity: 0.7;            -webkit-transition: opacity 300ms ease-in-out;            -moz-transition: opacity 300ms ease-in-out;            transition: opacity 300ms ease-in-out;        }        .crop img:hover        {            opacity: 1;        }

Note: This article love programming Original article, reprint please indicate the original address: http://www.w2bc.com/Article/8500


Observe the following graphic arrangement rules (where △is a triangle, □is a square, ○ is a circle), □○ □□□□□□□□□□□□□□,

11 images in one group
2012 bytes 11 = 182 ..... 10
Therefore, 2112 images are triangles, just like 10th images.

How to Use CSS to draw triangles, as shown in the figure? Background and CSS3 cannot be used.

<Style>. div1 {width: 0px; height: 0px; border-top: 200px solid black; border-left: 200px solid white ;}. div2 {width: 0px; height: 0px; border-top: 197px solid white; border-left: 197px solid transparent; position: relative; top:-199px; left: 2px ;}. div1: before {width: 200px; border-top: 1px solid black; position: relative; left:-200px; top:-1px; content: ""; display: block ;}. div1: after {height: 200px; border-right: 1px solid black; posit Ion: relative; left:-200px; top:-201px; content: ""; display: block ;} </style> <body> <div class = "div1"> </div> <div class = "div2"> </div> </body> you like to pack your bags. go...
FF is qualified, and other browsers debug it slowly.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.