I have a question about this CSS I wrote with tailwind. I am trying to overlap the pseudo-element over the div but I can't find the way. How can do get this to work, and can it be written in a cleaner way?
<div class="absolute flex h-[15px] w-[15px] border-[15px] border-l-[25px]
border-solid border-transparent border-l-green-300 bg-transparent
before:absolute before:h-[12px] before:w-[12px] before:border-[12px]
before:border-l-[20px] before:border-solid before:border-transparent
before:border-l-pink-300 before:bg-transparent">
</div>
This is other option I tried to write it cleaner but idk why it doesn't work :(
<div class=`${div-triangle}${pseudo-triangle}`></div>
<script>
let div-triangle = 'absolute flex h-[15px] w-[15px] border-[15px] border-l-[25px]
border-solid border transparent border-l-green-300 bg-transparent';
let pseudo-triangle = 'before:absolute before:h-[12px] before:w-[12px] before:border-[12px]
before:border-l-[20px] before:border-solid before:border-transparent
before:border-l-pink-300 before:bg-transparent';
</script>
<div>instead of a pseudo element – since this would mean you could use classes without thebefore:variant on this inner element, which could mean that these classes would be reused elsewhere in the project, thus reducing the amount of CSS rules and thus reducing potential CSS file size.