css-50 Projects in 50 Days(3)

html

html 复制代码
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>旋转页面</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css"
        integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog=="
        crossorigin="anonymous">
    <link rel="stylesheet" href="./style.css">

</head>

<body>
    <div id="container" class="container">

        <div class="content_wrapper">

            <div class="content">
                <div class="fs30 fw600 mt20 ">Amazing Article</div>
                <div class="fs16 cr_555 italic">Florin Pop</div>
                <p class="cr_555">Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusantium quia in ratione
                    dolores cupiditate,
                    maxime aliquid impedit dolorem nam dolor omnis atque fuga labore modi veritatis porro laborum minus,
                    illo, maiores recusandae cumque ipsa quos. Tenetur, consequuntur mollitia labore pariatur sunt quia
                    harum aut. Eum maxime dolorem provident natus veritatis molestiae cumque quod voluptates ab non,
                    tempore
                    cupiditate? Voluptatem, molestias culpa. Corrupti, laudantium iure aliquam rerum sint nam quas dolor
                    dignissimos in error placeat quae temporibus minus optio eum soluta cupiditate! Cupiditate saepe
                    voluptates laudantium. Ducimus consequuntur perferendis consequatur nobis exercitationem molestias
                    fugiat commodi omnis. Asperiores quia tenetur nemo ipsa.

                </p>
                <h3>My Xxx</h3>
                <img src="https://fastly.picsum.photos/id/866/1000/666.jpg?hmac=2bUfqZW-BtFbQv1wQf9cZrTnbI-mKI3cR5QJw4d4ycI"
                    alt="" srcset="" />
                <p class="cr_555">Lorem, ipsum dolor sit amet consectetur adipisicing elit. Sit libero deleniti rerum
                    quo,
                    incidunt vel consequatur culpa ullam. Magnam facere earum unde harum. Ea culpa veritatis magnam at
                    aliquid. Perferendis totam placeat molestias illo laudantium? Minus id minima doloribus dolorum
                    fugit
                    deserunt qui vero voluptas, ut quia cum amet temporibus veniam ad ea ab perspiciatis, enim accusamus
                    asperiores explicabo provident. Voluptates sint, neque fuga cum illum, tempore autem maxime
                    similique
                    laborum odio, magnam esse. Aperiam?

                </p>
            </div>
        </div>


    </div>
    <div id="left" class="left ">
        <div class="item"> <span class="fas fa-home mr8"></span><span>Home</span></div>

        <div class="item"><span class="fas fa-user-alt mr8"></span> <span>About</span></div>

        <div class="item"><span class="fas fa-envelope mr8"></span> <span>Contact</span></div>
    </div>
    <div id="rotate" class="rotate cur">
        <div class="rotate_item">
            <span class="fas fa-times"></span>
        </div>

        <div class="rotate_item">
            <span class="fas fa-bars"></span>
        </div>

    </div>
    <script src="./index.js"></script>
</body>

</html>

css

css 复制代码
html,
body {
    padding: 0;
    margin: 0;
    background-color: #333;
}

.fs30 {
    font-size: 30px;
}

.fs24 {
    font-size: 24px;
}

.fs16 {
    font-size: 16px;
}

.mt20 {
    margin-top: 20px;
}

.mt32 {
    margin-top: 32px;
}

.mb32 {
    margin-bottom: 32px;
}

.mb6 {
    margin-bottom: 6px;
}

.mr8 {
    margin-right: 8px;
}

.fw600 {
    font-weight: 600;
}

.cr_555 {
    color: #555;
}

.cr_999 {
    color: #999;
}

.italic {
    font-style: italic;
}

.cur {
    cursor: pointer;
}

.container_active {
    transform: rotate(-20deg);
}

.container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
    background-color: #fafafa;
    transition: all 0.5s ease;
    transform-origin: top left;

    .content_wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;


        .content {
            padding: 50px;
            margin: 50px auto;
            max-width: 1000px;

        }

        .content_active {
            transform: rotate(20deg);
        }
    }



}


.left {
    bottom: 40px;
    position: fixed;
    z-index: 100;
    padding: 0%;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 30px;

    .item {
        transition: transform 0.4s ease-in;

    }

    .item:nth-of-type(1) {
        padding-left: 0;
        transform: translateX(-100%);
    }

    .item:nth-of-type(2) {
        padding-left: 15px;
        transform: translateX(-150%);
    }

    .item:nth-of-type(3) {
        padding-left: 30px;
        transform: translateX(-200%);
    }

}

.left_active {
    .item {
        transition: transform 0.4s ease-in;
        transition-delay: 0.3s;
    }

    .item:nth-of-type(1) {
        transform: translateX(0%);
    }

    .item:nth-of-type(2) {
        transform: translateX(0%);
    }

    .item:nth-of-type(3) {
        transform: translateX(0%);
    }
}

.rotate {
    $w: 26px;
    position: absolute;
    left: -100px;
    top: -100px;
    width: 200px;
    height: 200px;
    background-color: #ff7979;
    border-radius: 50%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 100px;
    font-size: 26px;
    color: #fff;
    transition: all 0.5s ease;
    transform: rotate(0);

    .rotate_item {
        position: relative;


    }

    .rotate_item:nth-of-type(1) {
        width: 100%;
        height: 100%;
        grid-row: 2/2;

        span {
            position: absolute;
            left: 50%;
            top: 30%;
        }

    }

    .rotate_item:nth-of-type(2) {
        width: 100%;
        height: 100%;
        grid-row: 2/2;
        grid-column: 2/2;

        span {
            position: absolute;
            left: 30%;
            top: 30%;
        }
    }
}

.rotate_active {
    transform: rotate(-90deg);
}

js

javascript 复制代码
const state = {
    containerBox: document.querySelector('#container'),
    rotateBox: document.querySelector('#rotate'),
    leftBox: document.querySelector('#left'),
}

state.rotateBox.onclick = () => {
    state.containerBox.classList.toggle('container_active')
    state.leftBox.classList.toggle('left_active')
}
相关推荐
请叫我欧皇i17 分钟前
html本地离线引入vant和vue2(详细步骤)
开发语言·前端·javascript
533_19 分钟前
[vue] 深拷贝 lodash cloneDeep
前端·javascript·vue.js
guokanglun25 分钟前
空间数据存储格式GeoJSON
前端
zhang-zan1 小时前
nodejs操作selenium-webdriver
前端·javascript·selenium
猫爪笔记1 小时前
前端:HTML (学习笔记)【2】
前端·笔记·学习·html
brief of gali1 小时前
记录一个奇怪的前端布局现象
前端
Json_181790144802 小时前
电商拍立淘按图搜索API接口系列,文档说明参考
前端·数据库
风尚云网3 小时前
风尚云网前端学习:一个简易前端新手友好的HTML5页面布局与样式设计
前端·css·学习·html·html5·风尚云网
木子02043 小时前
前端VUE项目启动方式
前端·javascript·vue.js
GISer_Jing3 小时前
React核心功能详解(一)
前端·react.js·前端框架