How can i use hover effect on after element with css? -
this question has answer here:
this code, want show hover effect on after element.
#car:after:hover{background:red:}
but not working.
check out demo below. think missing content
property.
the red
div
created using :after
, changes color on hover.
the selector:after:hover
won't work.
.car { position: relative; width: 100px; height: 100px; background: yellow; } .car:hover { background: skyblue; } .car:after { content: ''; width: 50px; height: 50px; position: absolute; right: 0; bottom: 0; background: green; } .car:hover:after { background: red; }
<div class="car"></div>
Comments
Post a Comment