📝 代码查看
使用runcode.html页面

2
查看次数
2025-11-07
创建时间
2025-11-16
最后更新
<div class="g-container">
    <div class="section-one">translateZ(-1)</div>
    <div class="section-two">translateZ(-2)</div>
    <div class="section-three">translateZ(-3)</div>
</div>
html {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    padding: 0;
    perspective: 2px;
    transform-style: preserve-3d;
    transform-origin: center center;
    height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
}

.g-container {
    position: relative;
    transform-style: preserve-3d;
    height: 150%;
    
    & > div {
        font-size: 5vw;  
        position: absolute;
        top: 20%;
    }
    
    .section-one {
        left: 0%;
        background: rgba(10, 10, 10, .2);
        transform: translateZ(-1px);
    }
    
    .section-two {
        left: 40%;
        background: rgba(30, 130, 30, .2);
        transform: translateZ(-2px);
    }
    
    .section-three {
        left: 90%;
        background: rgba(200, 100, 130, .2);
        transform: translateZ(-3px);
    }
}
暂无JavaScript代码

👁️ 实时预览