Make the height of the pseudo-element the same as the element to which it is attached

I have a very quick question, but I donโ€™t know how to formulate it correctly in order to get the corresponding search result. Basically, I have <div class="element"></div> with .element{height:100px} . I am adding an after pseudo-element to my .element with the same height, but I'm not sure how to refer to the original height in the pseudo-definition.

Thanks. (I hope I just said it makes sense)

+4
source share
1 answer

Looks like you can just use 100%:

 .element:after { content: 'your generated content'; display: block; height: 100%; } 
+6
source

Source: https://habr.com/ru/post/1482826/