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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -