Hello. I am trying to understand the logic behind how .heart::before changes its shape the same way as .heart::after when I set its content to “” or an empty string. Also since .heart::before is like a reflection of .heart, couldn’t you just modify .heart’s content to “” and not having to use .heart::before at all?
**Your code so far**
**Your browser information:**
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
Challenge: Create a More Complex Shape Using CSS and HTML
Link to the challenge:
I don’t really understand the question.
::after are pseudo-elements. They show up as child elements of the element they are defined on.
If you inspect the DOM it looks like this (if the pseudo-elements have
other parent content
The content property with an empty string is used with pseudo-elements to make them show up, otherwise, they won’t. You can add text as well but you usually wouldn’t do that if they are used as graphical elements.
<h2>Some other title</h2>
content: "Chapter: ";
CSS Generated Content Module Level 3
The content property dictates what is rendered inside an element or pseudo-element.
For elements, it has only one purpose: specifying that the element renders as normal, or replacing the element with an image (and possibly some associated “alt text”).
For pseudo-elements and margin boxes, it is more powerful. It controls whether the element renders at all, can replace the element with an image, or replace it with arbitrary inline content (text and images).
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.