HTML Structure: There's a
tag containing a
JavaScript: It starts by selecting the container element using document.getElementById. It defines a constant numPoints which specifies the number of flowers to be created. The createPoint() function is defined, which creates a new flower element (
CSS: The body is styled to display flex, centering its content both horizontally and vertically, and setting its background color to black. The container class is styled with position relative and occupies the entire viewport (100vh). Two pseudo-elements ::before and ::after are used to create the stem and the base of the flower, respectively. They are positioned absolutely within the container. The .point class styles the flowers with a specific width, height, and background color gradient. It also applies border-radius to create the petal shape.
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #000000;
}
.container {
position: relative;
width: 100%;
height:100%;
}
.container::before{
content: '';
width: 70px;
height: 200px;
border-radius: 50%;
border-left: 10px solid green;
border-bottom: 10px solid transparent;
position: absolute;
top: 60%;
left: 49%;
}
.container::after{
content: '';
width:90px;
height:60px;
border-radius: 50%;
border-bottom: 20px solid transparent;
border-top: 20px solid green;
position: absolute;
top: 60%;
left: 50%;
}
.point {
width: 100px;
height: 100px;
background: rgb(244,226,54);
background:linear-gradient(180deg, rgba(244,226,54,1) 0%, rgba(253,29,29,1) 100%);
position: absolute;
border-top-right-radius: 0px;
border-bottom-left-radius:0px ;
border-bottom-right-radius: 200px;
border-top-left-radius: 200px;
}