Padající sníh

HTML Kody – Padající sníh

 Padající sníh

Kód html:


<h1> Toto je text </h1>
<h3>Efekt sněhu</h3>
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">
<div class="snowflake">

Kód CSS:

html, body {
padding: 0;
margin: 0;
width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
background: linear-gradient(#123, #111);
}
.snowflake {
--size: 1vw;
width: var(--size);
height: var(--size);
background: white;
border-radius: 50%;
position: absolute;
top: -5vh;
}
@keyframes snowfall {
0% {
transform: translate3d(var(--left-ini), 0, 0);
}
100% {
transform: translate3d(var(--left-end), 110vh, 0);
}
}
.snowflake:nth-child(1) {
--size: 0.4vw;
--left-ini: -8vw;
--left-end: 9vw;
left: 43vw;
animation: snowfall 14s linear infinite;
animation-delay: -4s;
}
.snowflake:nth-child(2) {
--size: 1vw;
--left-ini: -9vw;
--left-end: -1vw;
left: 5vw;
animation: snowfall 10s linear infinite;
animation-delay: -10s;
}
.snowflake:nth-child(3) {
--size: 1vw;
--left-ini: 10vw;
--left-end: -5vw;
left: 36vw;
animation: snowfall 15s linear infinite;
animation-delay: -1s;
}
.snowflake:nth-child(4) {
--size: 0.6vw;
--left-ini: 10vw;
--left-end: -7vw;
left: 69vw;
animation: snowfall 10s linear infinite;
animation-delay: -2s;
}
.snowflake:nth-child(5) {
--size: 0.8vw;
--left-ini: -3vw;
--left-end: 6vw;
left: 15vw;
animation: snowfall 8s linear infinite;
animation-delay: -10s;
}
.snowflake:nth-child(6) {
--size: 0.8vw;
--left-ini: -9vw;
--left-end: 6vw;
left: 24vw;
animation: snowfall 12s linear infinite;
animation-delay: -8s;
}
.snowflake:nth-child(7) {
--size: 1vw;
--left-ini: -2vw;
--left-end: -5vw;
left: 10vw;
animation: snowfall 10s linear infinite;
animation-delay: -4s;
}
.snowflake:nth-child(8) {
--size: 0.4vw;
--left-ini: -6vw;
--left-end: 5vw;
left: 25vw;
animation: snowfall 12s linear infinite;
animation-delay: -9s;
}
.snowflake:nth-child(9) {
--size: 0.8vw;
--left-ini: -6vw;
--left-end: 4vw;
left: 35vw;
animation: snowfall 12s linear infinite;
animation-delay: -9s;
}
.snowflake:nth-child(10) {
--size: 1vw;
--left-ini: 4vw;
--left-end: 3vw;
left: 56vw;
animation: snowfall 7s linear infinite;
animation-delay: -10s;
}
/* added small blur every 6 snowflakes*/
.snowflake:nth-child(6n) {
filter: blur(1px);
}
/***/
youtube {
z-index: 2;
display: block;
width: 100px;
height: 70px;
position: absolute;
bottom: 20px;
right: 20px;
background: red;
border-radius: 50%/11%;
transition: transform 0.5s;
}
youtube:hover,
youtube:focus {
transform: scale(1.1);
}
youtube::before {
content: "";
display: block;
position: absolute;
top: 7.5%;
left: -6%;
width: 112%;
height: 85%;
background: red;
border-radius: 9%/50%;
}
youtube::after {
content: "";
display: block;
position: absolute;
top: 20px;
left: 40px;
width: 45px;
height: 30px;
border: 15px solid transparent;
box-sizing: border-box;
border-left: 30px solid white;
}
youtube span {
font-size: 0;
position: absolute;
width: 0;
height: 0;
overflow: hidden;
}

3 Responses to “Padající sníh”

  1. Míša

    Nevím proč, ale vždycky , když jsem toto dala do HTML kódu na stránku (Dokonce jsem to zkoušela na dvě rozdílné), ale se akorát ukázal odkaz této stránky -.-

Leave a Reply to Vítek

Odpověď na komentář zrušíte zde.