Kevin Powell - CommunityKP-C
Kevin Powell - Communityโ€ข2y agoโ€ข
20 replies
pastilhas

css pseudo element ::before

Hello, you masters of the CSS.
I have reviewed the videos from Kevin on pseudo elements to try and see if he mentioned what i'm looking for.
Would love your input on this:

Right now, the element, when "selected" is getting a "selected" class that adds that background to it.
What i would really like, would be something like:

.selected::before {
  position: absolute; // or fixed maybe
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: ...;
}


what i'm trying to achive and haven't been successful is:
- a ::before pseudo element,
- that would stand behind my selected element (can be any element, inline or block)
- would take the exact dimensions of the selected element


is this possible? how?

Thank you
Was this page helpful?