HTML玫瑰花綻放開代碼
<!DOCTYPE html>
<html>
<head>
<title>玫瑰花綻放開</title>
<style>
#rose {
width: 200px;
height: 200px;
background-color: pink;
border-radius: 50%;
position: relative;
margin: 50px auto;
overflow: hidden;
}
#rose:before {
content: "";
width: 100px;
height: 100px;
background-color: white;
border-radius: 50%;
position: absolute;
left: 25%;
top: 25%;
}
#rose:after {
content: "";
width: 100px;
height: 100px;
background-color: white;
border-radius: 50%;
position: absolute;
right: 25%;
top: 25%;
}
#rose .circle {
width: 60px;
height: 60px;
background-color: pink;
border-radius: 50%;
position: absolute;
transform: rotate(45deg);
transform-origin: center center;
animation: rotate 4s linear infinite;
}
#rose .circle.left {
left: 40px;
top: 70px;
}
#rose .circle.right {
right: 40px;
top: 70px;
}
@keyframes rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
以上是HTML玫瑰花綻放開的代碼,利用CSS的偽元素和動畫效果,讓兩個圓圈圍繞著中間的圓心,形成一朵美麗的玫瑰花。我們可以將這段代碼復制到自己的項目中,達到相同的效果。