One of the most popular shapes in the world is the heart shape, and in this challenge you'll create one using pure CSS. But first, you need to understand the::beforeand::afterpseudo-elements. These pseudo-elements are used to add something before or after a selected element. In the following example, a::beforepseudo-element is used to add a rectangle to an element with the classheart:
For the::beforeand::afterpseudo-elements to function properly, they must have a definedcontentproperty. This property is usually used to add things like a photo or text to the selected element. When the::beforeand::afterpseudo-elements are used to make shapes, thecontentproperty is still required, but it's set to an empty string. In the above example, the element with the class ofhearthas a::beforepseudo-element that produces a yellow rectangle with height and width of50pxand70px, respectively. This rectangle has round corners due to its 25%border-radiusand is positioned absolutely at5pxfrom the left and50pxabove the top of the element.
Transform the element on the screen to a heart. In theheart::afterselector, change thebackground-colortopinkand theborder-radiusto 50%.
Next, target the element with the classheart(justheart) and fill in thetransformproperty. Use therotate()function with -45 degrees.
Finally, in theheart::beforeselector, set itscontentproperty to an empty string.