How does adding "", double the image?

Tell us what’s happening:

Hello everyone, so I was doing this challenge and I really don’t understand when I add the “” value for the content attribute in the heart::before, it mirrors what is already is on the screen from heart::after. Why does adding “”, automatically doubles what is on the page and makes the full heart? Thanks in advanced.

Your code so far


<style>
.heart {
  position: absolute;
  margin: auto;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: pink;
  height: 50px;
  width: 50px;
  transform: rotate(-45deg);
}
.heart::after {
  background-color: pink;
  content: "";
  border-radius: 50%;
  position: absolute;
  width: 50px;
  height: 50px;
  top: 0px;
  left: 25px;
}
.heart::before {
  content:"" ;
  background-color: pink;
  border-radius: 50%;
  position: absolute;
  width: 50px;
  height: 50px;
  top: -25px;
  left: 0px;
}
</style>
<div class = "heart"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/applied-visual-design/create-a-more-complex-shape-using-css-and-html

The before and after pseudo elements need content to be displayed, so once you add content with "", even if it is empty, you are making the before speudoelement appear, if you check you will see that in the after element it was already there

1 Like