0

Pseudo Elements

How do i get the double colon part (::before) inside the .green part? .green { z-index: 3; position: relative; background:-webkit-linear-gradient(360deg, Black, #006600); width: 120px; height: 120px; color: #FFF; margin-top: -175px; margin-left: 100px; border-radius:5px; } .green::before { content: url("https://wow.zamimg.com/images/wow/icons/medium/inv_misc_food_15.jpg");

18th Apr 2020, 8:14 PM
Peter Svärd
Peter Svärd - avatar
2 odpowiedzi
+ 2
You can apply a rule of css styles to more than one selector at the same time by separating them with a comma. Then use additional rules to each individual selector as needed for the styles that apply only to that selector. .green, .green::before { ...styles that apply to both } .green { ... styles that apply only to .green } .green::before { ... styles that apply only to .green::before } Etc.
18th Apr 2020, 10:26 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
You should clarify your question a bit.. "Getting the pseudo element inside something".... If you want to apply same style for both, which I assume as you gave a css snippet, you can just copy it and apply it on both... https://developer.mozilla.org/en-US/docs/Web/CSS/::before
18th Apr 2020, 8:59 PM
Arushi Singhania
Arushi Singhania - avatar