Sobes.tech
Back to tasks
Junior — Senior
22

Разбор работы представленного HTML‑CSS кода

Companies where asked:

Учи.руУчи.ру
Get help with live coding in real time with Sobes Copilot
Task condition

Объясните, как функционирует следующий фрагмент кода, описав роль каждой части и взаимодействие стилей:

<html>
<head>
    <style>
    :root {
    --target-y: 100wh
    }

    @media(max-height:500px) {
    :root {
    --target-y: 400px
    }
    }

    @keyframes fromTarget {
    0% { transform: translate3d(0,var(--target-y),0); }
    100% { transform: translate3d(0,0,0); }
    }

    #target {
    animation: fromTarget ls ease-in;
    }
    </style>
</head>
<body>
    <div id="target"></div>
</body>
</html>