What's the difference between `*::before` and `::before` and why would I use it? Stumbled across it in a blog post.
Conversation
Notices
-
Kai Klostermann (odddev@floss.social)'s status on Saturday, 21-Dec-2024 17:38:03 JST Kai Klostermann -
Aral Balkan (aral@mastodon.ar.al)'s status on Saturday, 21-Dec-2024 17:38:01 JST Aral Balkan @OddDev * means every element. So you’d be setting styles to be applied to the before pseudo-element of every element. Likely not what you want to do :)
-
Aral Balkan (aral@mastodon.ar.al)'s status on Saturday, 21-Dec-2024 17:40:58 JST Aral Balkan @OddDev Although, if you scope it to another element, then it’ll mean every element within that scope, which could be useful.
e.g., nav *::before {} would apply those styles before every element in your nav.
-
Aral Balkan (aral@mastodon.ar.al)'s status on Saturday, 21-Dec-2024 17:44:15 JST Aral Balkan @OddDev (Whereas nav::before {} would only apply the styles before the nav element itself.)
-
Aral Balkan (aral@mastodon.ar.al)'s status on Saturday, 21-Dec-2024 21:44:39 JST Aral Balkan @OddDev Yeah, at a quick glance, not sure. Take it out and see what happens :)
-
Kai Klostermann (odddev@floss.social)'s status on Saturday, 21-Dec-2024 21:44:40 JST Kai Klostermann @aral Ah okay, so it's no special syntax really. Thank you so much!
Wondering why they did that here tho: https://www.kallmanation.com/styling-a-radio-button-with-only-css
-
Aral Balkan (aral@mastodon.ar.al)'s status on Saturday, 21-Dec-2024 21:48:20 JST Aral Balkan @OddDev Thought as much :)
In conversation permalink -
Kai Klostermann (odddev@floss.social)'s status on Saturday, 21-Dec-2024 21:48:21 JST Kai Klostermann @aral It's the same. 🫠 Maybe it's just an oopsie in the post.
In conversation permalink
-