Answer the question
In order to leave comments, you need to log in
How to make the after pseudo-element width from the edge of the parent to the edge of the page?
How can I make the after pseudo-element, on hover, start at the left edge of the parent and end at the right edge of the page?
<div class="flex">
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
</div>
.flex
display: flex
justify-content: space-between
.block
position: relative
width: 50px
height: 50px
background-color: red
&::after
content: ''
display: block
position: absolute
left: 0
bottom: 0
height: 5px
width: 0
background-color: green
&:hover::after
width: ???
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question