内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

使用css3怎么實(shí)現(xiàn)一個(gè)魔方3d效果-創(chuàng)新互聯(lián)

使用css3怎么實(shí)現(xiàn)一個(gè)魔方3d效果 ?很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

為河南等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計(jì)制作服務(wù),及河南網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為做網(wǎng)站、網(wǎng)站設(shè)計(jì)、河南網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!

css是什么意思

css是一種用來表現(xiàn)HTML或XML等文件樣式的計(jì)算機(jī)語言,主要是用來設(shè)計(jì)網(wǎng)頁的樣式,使網(wǎng)頁更加美化。它也是一種定義樣式結(jié)構(gòu)如字體、顏色、位置等的語言,并且css樣式可以直接存儲(chǔ)于HTML網(wǎng)頁或者單獨(dú)的樣式單文件中,而樣式規(guī)則的優(yōu)先級(jí)由css根據(jù)這個(gè)層次結(jié)構(gòu)決定,從而實(shí)現(xiàn)級(jí)聯(lián)效果,發(fā)展至今,css不僅能裝飾網(wǎng)頁,也可以配合各種腳本對(duì)于網(wǎng)頁進(jìn)行格式化。

html:


<div class="container">
        <div class="box defaul">
            <div class="pic"><img src="./img/cat.jpg" alt=""></div>
            <div class="pic"><img src="./img/dog.jpg" alt=""></div>
            <div class="pic"><img src="./img/elephant.jpg" alt=""></div>
            <div class="pic"><img src="./img/lion.jpg" alt=""></div>
            <div class="pic"><img src="./img/rabbit.jpg" alt=""></div>
            <div class="pic"><img src="./img/monkey.jpg" alt=""></div>
        </div>
    </div>
    <h2>點(diǎn)擊下面的圖片按鈕切換</h2>
    <div class="btn">
        <input type="image" class="1" src="./img/cat.jpg">
        <input type="image" class="2" src="./img/dog.jpg">
        <input type="image" class="3" src="./img/elephant.jpg">
        <input type="image" class="4" src="./img/lion.jpg">
        <input type="image" class="5" src="./img/rabbit.jpg">
        <input type="image" class="6" src="./img/monkey.jpg">
    </div>

css:

   * {
        margin: 0;
        padding: 0;
    }
    html,
    body {
        width: 100%;
        height: 100%;
        background: #66677c;
        text-align: center;
    }
    .container {
        width: 300px;
        height: 300px;
        margin: 50px auto 150px;
        perspective: 1200px;
    }
    .container .box {
        width: 300px;
        height: 300px;
        position: relative;
        transform-style: preserve-3d;
        transition: transform 0.5s;
    }
    .container .box .pic {
        position: absolute;
        left: 0;
        top: 0;
        width: 300px;
        height: 300px;
        box-shadow: 0px 0px 5px #fff;
    }
    .container .box .pic img {
        width: 100%;
        height: 100%;
        cursor: pointer;
    }
    .container .box .pic:nth-child(1) {
        transform: translateZ(150px);
    }
    .container .box .pic:nth-child(2) {
        transform: rotateY(-180deg) translateZ(150px);
    }
    .container .box .pic:nth-child(3) {
        transform: rotateY(90deg) translateZ(150px);
    }
    .container .box .pic:nth-child(4) {
        transform: rotateY(-90deg) translateZ(150px);
    }
    .container .box .pic:nth-child(5) {
        transform: rotateX(90deg) translateZ(150px);
    }
    .container .box .pic:nth-child(6) {
        transform: rotateX(-90deg) translateZ(150px);
    }
    h2 {
        color: #fff;
        font-size: 30px;
        margin-bottom: 30px;
    }
    .btn {
        display: grid;
        justify-content: center;
        grid-template-columns: 100px 100px 100px;
        grid-template-rows: 100px 100px;
        grid-gap: 15px;
    }
    .btn input {
        width: 100px;
        height: 100px;
        outline: none;
        border: 2px solid #fff;
    }
    .btn input:focus {
        border: 2px solid #e70;
    }
    .defaul {
        transform: translateZ(-150px) rotateX(-10deg) rotateY(15deg);
    }
    .image1 {
        transform: translateZ(-150px) rotateX(0deg) rotateY(0deg);
    }
    .image2 {
        transform: translateZ(-150px) rotateY(-180deg);
    }
    .image3 {
        transform: translateZ(-150px) rotateY(-90deg);
    }
    .image4 {
        transform: translateZ(-150px) rotateY(90deg);
    }
    .image5 {
        transform: translateZ(-150px) rotateX(-90deg);
    }
    .image6 {
        transform: translateZ(-150px) rotateX(90deg);
    }

js:

 (function(){
        var btn = document.getElementsByClassName('btn')[0];
        var box = document.getElementsByClassName('box')[0];
        btn.addEventListener('click',function(e){
            var className = e.target.className;
            if(className !== 'btn'){
                box.style = '';
                box.classList.replace(box.classList[1],'image'+className);
            }
        })
        //鼠標(biāo)拖動(dòng)效果
        var xN = 10, yN = 15;
        document.addEventListener('mousedown',function(e){
            e.preventDefault();
            e.stopPropagation();
            var x = e.clientX;
            var y = e.clientY;
            document.addEventListener('mousemove',move);
            document.addEventListener('mouseup', up);
            function move(e){
                e.preventDefault();
                e.stopPropagation();
                var x1 = e.clientX;
                var y1 = e.clientY;
                xN += (x1 - x)*0.04;
                yN += (y1 - y)*0.04;
                box.style.transform = 'translateZ(-150px) rotateY(' + xN + 'deg) rotateX(' + -yN + 'deg)';
            }
            function up(){
                document.removeEventListener('mousemove', move);
            }
        })
    })()

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,的支持。

標(biāo)題名稱:使用css3怎么實(shí)現(xiàn)一個(gè)魔方3d效果-創(chuàng)新互聯(lián)
分享網(wǎng)址:http://www.rwnh.cn/article32/coigsc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)面包屑導(dǎo)航、服務(wù)器托管、網(wǎng)站排名、網(wǎng)站改版、靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
崇左市| 旬阳县| 自治县| 绍兴市| 焉耆| 施秉县| 东源县| 丰镇市| 阿合奇县| 迁安市| 玉山县| 阜新| 镇安县| 扶余县| 永新县| 乌审旗| 新昌县| 垣曲县| 葫芦岛市| 馆陶县| 浑源县| 东平县| 天柱县| 清新县| 遂川县| 淮滨县| 绥江县| 蓬莱市| 夏津县| 浏阳市| 上饶县| 西乌珠穆沁旗| 乌恰县| 湛江市| 军事| 盐池县| 莒南县| 桐庐县| 徐闻县| 方城县| 武义县|