비전공자 개발일기

Police VS Taxi 본문

HTML _CSS

Police VS Taxi

HiroDaegu 2023. 1. 30. 00:09
728x90
SMALL

 

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

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>POLICE VS TAXI</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="road">

        <div class="police">
            <div class="light_beam"></div>
            <h4>police</h4>
            <h3>police</h3>
            <div class="side_mirror"></div>
            <span>
                <b></b>
                <i></i>
            </span>
        </div>

        <div class="police">
            <div class="light_beam"></div>
            <h4>police</h4>
            <h3>police</h3>
            <div class="side_mirror"></div>
            <span>
                <b></b>
                <i></i>
            </span>
        </div>

        <div class="taxi">
            <div class="light_beam"></div>
            <div class="side_mirror"></div>
            <span>
                <b></b>
                <i></i>
            </span>
        </div>

    </div>
</body>

</html>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #355463;
    overflow: hidden;
}

.road {
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    transform: rotate(-15deg);
}

.road::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #FFF, #FFF 50%, transparent 50%, transparent 100%);
    background-size: 50px;
    animation: animate_road 0.0125s linear infinite;
}

@keyframes animate_road {
    0% {
        background-position: 50px 0;
    }
    100% {
        background-position: 0 0;
    }
}

.road .police {
    position: absolute;
    left: -100px; 
    width: 200px;
    height: 80px;
    background-color: #3F4C54;
    border-radius: 10px;
    box-shadow: -10px -10px rgba(0, 0, 0, .05);
    transform-style: preserve-3d;
    perspective: 800px;
    z-index: 10;
    animation: animate_police_car 5s linear infinite;
}

.road .police:nth-child(2) {
    left: 200px;
    animation-delay: -2.5s;
}

@keyframes animate_police_car {
    0%, 100% {
        transform: translateX(20px) translateY(-50px);
    }
    25% {
        transform: translateX(-10px) translateY(0);
    }
    50% {
        transform: translateX(20px) translateY(50px);
    }
    75% {
        transform: translateX(-10px) translateY(0);
    }
}

.road .police::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 2px;
    width: 5px;
    height: 15px;
    background-color: #FC3C25;
    box-shadow: 0 42px #FC3C25;
}

.road .police::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 2px;
    width: 6px;
    height: 16px;
    background-color: #FFF;
    box-shadow: 0 44px #FFF;
}

.road .light_beam {
    position: absolute;
    top: 5px;
    right: -2px;
    width: 10px;
    height: 70px;
    background-color: #0002;
    border-radius: 15px; 
    transform-style: preserve-3d;
}

.road .light_beam::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 0;
    width: 150px;
    height: 16px;
    background: linear-gradient(90deg, #FFF6, transparent);
    transform-origin: left;
    transform: perspective(500px) rotateY(-50deg);
}

.road .light_beam::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 150px;
    height: 16px;
    background: linear-gradient(90deg, #FFF6, transparent);
    transform-origin: left;
    transform: perspective(500px) rotateY(-50deg);
}

.road .police h4 {
    position: absolute;
    top: 50%;
    left: 0;
    color: #FFF;
    text-transform: uppercase;
    transform: translateY(-50%) rotate(90deg) scale(.75);
    z-index: 10;
}

.road .police h3 {
    position: absolute;
    top: 50%;
    right: -2%;
    color: #FFF;
    text-transform: uppercase;
    transform: translateY(-50%) rotate(270deg) scale(.75);
    z-index: 10;
}

.road .police .side_mirror {
    position: absolute;
    inset: 0;
}

.road .police .side_mirror::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 40px;
    width: 5px;
    height: 10px;
    background-color: #EBEBEB;
    border-top-right-radius: 10px;
}

.road .police .side_mirror::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 40px;
    width: 5px;
    height: 10px;
    background-color: #EBEBEB;
    border-bottom-right-radius: 10px;
}

.road .police span {
    position: absolute;
    inset: 5px 10px;
    background-color: #475B66;
    border-radius: 10px;
    overflow: hidden;
}

.road .police span::before {
    content: '112';
    position: absolute;
    top: 50%;
    left: 48%;
    transform: translate(-50%, -50%) rotate(90deg);
    color: #333;
    font-size: 1.15em;
    font-weight: 700;
    letter-spacing: .1em;
    z-index: 10;
}

.road .police span::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 6px;
    height: 10px;
    background-color: #29282B;
    box-shadow: 0 -10px #1F5FFF, 0 10px #DF1B25;
}

.road .police span b {
    position: absolute;
    inset: 0 30px;
    background-color: #344650;
    border-radius: 10px;
}

.road .police span b::before {
    content: '';
    position: absolute;
    inset: 6px 25px;
    background-color: #EBEBEB;
    border-radius: 5px;
}

.road .police span b::after {
    content: '';
    position: absolute;
    inset: 0 58px;
    background-color: #EBEBEB;
}

.road .police span i {
    position: absolute;
    inset: 0;
}

.road .police span i::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 20px;
    width: 40px;
    height: 5px;
    background-color: #EBEBEB;
    transform-origin: right;
    transform: rotate(15deg);
    box-shadow: 100px 34px #EBEBEB;
}

.road .police span i::after {
    content: '';
    position: absolute;
    bottom: 7px;
    left: 20px;
    width: 40px;
    height: 5px;
    background-color: #EBEBEB;
    transform-origin: right;
    transform: rotate(-15deg);
    box-shadow: 100px -34px #EBEBEB;
}

.road .taxi {
    position: absolute;
    right: 50px; 
    width: 200px;
    height: 80px;
    background-color: #F4B503;
    border-radius: 10px;
    box-shadow: -10px -10px rgba(0, 0, 0, .1);
    transform-style: preserve-3d;
    perspective: 800px;
    z-index: 10;
    animation: animate_taxi 5s linear infinite;
    animation-delay: -5s;
}

@keyframes animate_taxi {
    0%, 100% {
        transform: translateX(20px) translateY(20px);
    }
    25% {
        transform: translateX(-50px) translateY(0);
    }
    50% {
        transform: translateX(20px) translateY(-20px);
    }
    75% {
        transform: translateX(50px) translateY(0); 
    }
}

.road .taxi::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 2px;
    width: 5px;
    height: 15px;
    background-color: #FC3C25;
    box-shadow: 0 42px #FC3C25;
}

.road .taxi::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 2px;
    width: 6px;
    height: 16px;
    background-color: #FFF;
    box-shadow: 0 44px #FFF;
}

.road .taxi span {
    position: absolute;
    inset: 5px 10px;
    background-color: #FDD206;
    border-radius: 10px;
    overflow: hidden;
}

.road .taxi span::before {
    content: 'Taxi';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    background-color: #FFF;
    padding: 2px;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    border-radius: 2px;
    box-shadow: 0 0 0 1px #0005;
    z-index: 100;
}

.road .taxi span b {
    position: absolute;
    inset: 0 30px;
    background-color: #111;
    border-radius: 10px;
}

.road .taxi span b::before {
    content: '';
    position: absolute;
    inset: 6px 25px;
    background-color: #FDD206;
    border-radius: 5px;
}

.road .taxi span b::after {
    content: '';
    position: absolute;
    inset: 0 58px;
    background-color: #FDD206;
}

.road .taxi span i {
    position: absolute;
    inset: 0;
}

.road .taxi span i::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 20px;
    width: 40px;
    height: 5px;
    background-color: #FDD206;
    transform-origin: right;
    transform: rotate(15deg);
    box-shadow: 100px 34px #FDD206;
}

.road .taxi span i::after {
    content: '';
    position: absolute;
    bottom: 7px;
    left: 20px;
    width: 40px;
    height: 5px;
    background-color: #FDD206;
    transform-origin: right;
    transform: rotate(-15deg);
    box-shadow: 100px -34px #FDD206;
}

.road .taxi .side_mirror {
    position: absolute;
    inset: 0;
}

.road .taxi .side_mirror::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 40px;
    width: 5px;
    height: 10px;
    background-color: #FDD206;
    border-top-right-radius: 10px;
}

.road .taxi .side_mirror::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 40px;
    width: 5px;
    height: 10px;
    background-color: #FDD206;
    border-bottom-right-radius: 10px;
}
728x90
LIST

'HTML _CSS' 카테고리의 다른 글

Shine effect on hover  (0) 2023.02.01
Bubbles on Button Clicked  (0) 2023.01.31
Rainbow Loader  (0) 2023.01.29
Star Rating  (0) 2023.01.28
Fill Glass Loader  (0) 2023.01.27