css布局实现iphone12手机效果代码

代码语言:html

所属分类:布局界面

代码描述:css布局实现iphone12手机效果代码

代码标签: iphone12 手机 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <style>
        * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    body {
        position: relative;
        height: 100vh;
        background: rgb(238, 228, 255);
    }
    
    .edge {
        position: absolute;
        top: 400px;
        left: 312px;
        height: 43px;
        width: 660px;
        background: linear-gradient(to right, rgb(78, 68, 133)1%, rgb(190, 187, 233)3%,rgb(109, 98, 156)8%, rgb(175, 167, 219)20%,rgb(109, 98, 156)92%,rgb(196, 193, 240)97.5%,rgb(94, 90, 131)100%);
        border-radius: 0 0 20px 20px;
       box-shadow: inset 0px 1px 2px 3px rgb(103, 90, 128);
        z-index: -1;
    }
    .edge::before /*vertical stripes*/{
    content: "";;
    position: absolute;
    left: 60px;
    height: 40px;
    width: 8px;
    background: linear-gradient(to bottom, rgb(146, 133, 206)20%, rgb(168, 155, 216)60%, rgb(137, 116, 194));
    }
    .edge::after /*vertical stripes*/{
        content: "";;
        position: absolute;
        right: 60px;
        height: 40px;
        width: 8px;
        background: linear-gradient(to bottom, rgb(146, 133, 206)20%, rgb(168, 155, 216)60%, rgb(137, 116, 194));
        }
    
        .volume-up {
            position: absolute;
            top: 19px;
            left: 160px;
            height: 13px;
            width: 50px;
            background: transparent;
            border-radius: 50px;
            box-shadow: 0px -0.7px 1px 1px rgb(85, 76, 112), inset 0px 0.8px 1px 1px rgb(190, 187, 233);
        }
        .volume-up::before /*silent*/ {
            content: "";
            position: absolute;
            top: 4px;
            left: -60px;
            height: 8px;
            width: 30px;
            background: transparent;
            border-radius: 50px;
            box-shadow: 0px -0.7px 0px 1px rgb(62, 53, 83), inset 0px -1px 3px 2px rgb(88, 72, 110);
        }
    
        .volume-up::after /*silent*/ {
            content: "";
            position: absolute;
            top: 1px;
            left: -60px;
            height: 5px;
            width: 30px;
            background: rgb(161, 151, 202);
            border-bottom: 1px solid rgb(100, 82, 124);
            border-top: 1.7px solid rgb(75, 56, 105);
            border-radius: 50px;
            box-shadow: inset 0px 0.9px 1px 0.5px rgb(189, 159, 231);
        }
    
        .volume-down {
            position: absolute;
            top: 19px;
            left: 225px;
            height: 13px;
            width: 50px;
            background: transparent;
            border-radius: 50px;
            box-shadow: 0px -0.7px 0px 1px rgb(77, 72, 105), inset 0px 1px 1px 1px rgb(190, 187, 233);
        }
        .volume-down:before /*sim insert*/ {
            content: "";
            position: absolute;
            top: 0px;
            left: 235px;
            width: 75px;
            height: 12px;
            background: transparent;
            border: rgb(110, 89, 134) solid 1px;
            border-radius: 50px;
        }
        .volume-down::after /*sim insert*/ {
            content: "";
            position: absolute;
            top: 4px;
            left: 300px;
            width: 6px;
            height: 5px;
            background: rgb(16, 10, 24);
            box-shadow:inset -0.5px -1px 1px rgb(231, 212, 255);
            border-radius: 50%;
        }
    
    .screen-base {
    position: absolute;
    top: 320px;
    left: 300px;
    height: 90px;
    width: 685px;
    background-color: #000;
    clip-path: polygon(13% 0%, 87% 0%, 100% 100%, 0% 100%);
    border-radius: 40px;
    box-shadow: inset 2px 1px 2px 4.5px rgb(190, 181, 235);
    }
    
    .screen-top {
        position: absolute;
    top: 322px;
    left: 320px;
    height: 80px;
    width: 644px;
    background: linear-gradient(40deg, rgb(170, 156, 231)5%, rgb(73, 57, 165)20%, rgb(16, 9, 77)80%, rgb(52, 0, 155)93%);
    clip-path: polygon(12% 0%, 88% 0%, 100% 100%, 0% 100%);
    border-radius: 28px;
    }
    .screen-top::before /*left*/{
        content: "";
        position: absolute;
        top: 64px;
        left: 6px;
        height: 20px;
        width: 10px;
        background: rgb(0, 0, 0);
        clip-path: polygon(57% 29%, 53% 46%, 57% 64%, 71% 80%, 20% 75%, 20% 28%, 71% 9%);
    }
    .screen-top::after /*right*/ {
        content: "";
        position: absolute;
        top: 65px;
        right: 6px;
        height: 20px;
        width: 10px;
        background: rgb(0, 0, 0);
        clip-path: polygon(57% 23%, 60% 39%, 57% 57%, 48% 75%, 98% 67%, 95% 28%, 48% 6%);
    } 
    
    /* graphics-lower */
    .graphic-lower {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-85%,-38%);
        height: 120px;
        width: 300px;
        border-radius: 50%;
        background: radial-gradient(rgba(97, 68, 194, 0.835)40%,rgb(234, 219, 255)80%);
        z-index: 2;
    }
    .graphic-lower::before {
        content:"";
        position: absolute;
        top: 18px;
        left: -40px;
        height: 50px;
        width: 40px;
        background: black;
        border-radius: 1% 20% 20% 1%;
    transform: skew(-44deg);
    }
    .graphic-lower:after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(20%,-47%);
        height: 105px;
        width: 300px;
        border-radius: 50%;
        background: radial-gradient(rgba(62, 47, 153, 0.925)55%,rgb(208, 197, 255)85%);
        z-index: 3;
    }
    
    /* middle  */
    .graphic-middle {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-30%);
        height: 98px;
        width: 360px;
        border-radius: 50%;
        background: radial-gradient(rgba(41, 10, 126, 0.911)30%,rgba(255, 50, 211, 0.5)60%, rgb(255, 255, 255)82%);
        z-index: 4;
    }
    
    /* top  */
    .graphic-middle:after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-80%);
        height: 40px;
        width: 160px;
        border-radius: 50%;
        box-shadow: inset -3px -1px 9px 2px rgb(85, 66, 170);
        background: linear-gradient(165deg, rgb(223, 145, 226)33%,rgba(255, 124, 237, 0.746)42%, rgb(51, 18, 112)80%,rgb(21, 0, 92)99%);
    }
    
    /* ######## reflection ######### */
    .graphic-middle::before {
        content: "";
        position: absolute;
        top: -8px;
        left: -37px;
        height: 98px;
        width: 434px;
        border-radius: 50%;
        box-shadow: inset 1px 1px 10px rgba(255, 255, 255, 0.236);
    }
    
    .reflection-screen {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-51%, -57%);
        height: 90px;
        width: 560px;
        clip-path: polygon(13% 0%, 87% 0%, 100% 100%, 0% 100%);
        border-radius: 50px;
        border: solid rgba(0, 0, 0, 0.25) 4px ;
        border-left: solid rgba(0, 0, 0, 0.25) 14px;
        box-shadow: -2px 1px 4px 4.5px rgb(202, 181, 255);
        opacity: 0.5;
    z-index: 5;
    }
    .reflection-screen::before /*black top screen*/{
        content: "";
        position: absolute;
        top: 18px;
        left: 25px;
        height: 50px;
        width: 35px;
        background: rgb(0, 0, 0, 0.25);
        border-radius: 1% 20% 20% 1%;
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0