👏CSS 实现大红灯笼动画,祝大家元旦快乐,2023越来越棒!速速来Get吧~
🥇文末分享源代码。记得点赞+关注+收藏!

:root {--lineColor: #ecaa2f;--bg: #f00;
}
.container {width: 200px;height: 150px;position: relative;
}

.center {position: relative;width: 100%;height: 100%;background: var(--bg);border-radius: 120px;box-shadow: 0 0 80px -10px var(--bg);
}
.center-line {width: 100%;height: 100%;}

.center-line::before {content: "";position: absolute;top: 0;left: calc(50% - 75px);width: 150px;height: 150px;border: 2px solid var(--lineColor);border-radius: 50%;
}

.center-line::after {content: "";position: absolute;top: 0;left: calc(50% - 35px);width: 70px;height: 150px;border: 2px solid var(--lineColor);border-radius: 50%;
}

元旦快乐
.center-line span {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);width: 18px;font-size: 18px;color: var(--lineColor);font-weight: bold;
}

.center::before {content: "";position: absolute;top: -8px;left: calc(50% - 40px);width: 80px;height: 10px;background: var(--lineColor);border-radius: 5px 5px 0 0;z-index: 2;
}

.center::after {content: "";width: 80px;height: 10px;background: var(--lineColor);border-radius: 0 0 5px 5px;position: absolute;bottom: -8px;left: calc(50% - 40px);z-index: 2;
}

+
.head-line {position: absolute;left: calc(50% - 2px);top: -60px;width: 4px;height: 60px;background-color: var(--lineColor);
}

+
.footer-line {position: absolute;left: calc(50% - 2px);bottom: -50px;width: 4px;height: 50px;background-color: var(--lineColor);z-index: -1;
}

.footer-line::after {content: "";position: absolute;bottom: -75px;left: calc(50% - 8px);width: 16px;height: 80px;background: linear-gradient(#f00,#e36d00 3px,#fbd342 5px,#e36d00 8px,#e36d00 12px,#f00 16px,rgba(255, 0, 0, 0.8) 26px,rgba(255, 0, 0, 0.6));border-radius: 5px 5px 0 0;
}
@keyframes rotate {0%,100% {transform: rotate(-10deg);}50% {transform: rotate(10deg);}
}

.footer-line {+ animation: rotate 3s infinite ease-in-out;
}

.center {+ animation: rotate 3s infinite ease-in-out;
}

.center {+ transform-origin: top center;
}
.container {+ animation: rotate 3s infinite ease-in-out;
}
CSS 实现灯笼动画 元旦快乐