html - CSS transition fade out using opacity is not working -


i trying have div on hover image fades out (so can see gray background behind) , text fades in. have been trying using css transitions, opacity not seem change (i.e. can still see background image).

html:

<div id='options'>   <div class='option'>     <div class='back-option'>     </div>     <div class='front-option'>       add post     </div>   </div> </div> 

css:

#options {   font-family: 'segoe ui', 'arial', sans-serif; }  .option {   position: relative;   width: 6.25em;   height: 6.25em;   border-radius: 5px;   cursor: pointer;   background-color: #363636; }  .back-option {   position: absolute;   width: 6.25em;   height: 6.25em;   border-radius: 5px;   background-image: url(http://png-5.findicons.com/files/icons/2672/pixel_ui/16/add.png);   background-size: contain;   -webkit-box-shadow: inset 0px 0px 0px 2px rgba(0,0,0,0.75);   -moz-box-shadow: inset 0px 0px 0px 2px rgba(0,0,0,0.75);   box-shadow: inset 0px 0px 0px 2px rgba(0,0,0,0.75);   opacity: 1;   transition: opacity 0.5s; } .back-option:hover {   opacity: 0; }  .front-option {   position: absolute;   width: 6.25em;   height: 6.25em;   border-radius: 5px;   color: #ffffff;   font-weight: bold;   text-align: center;   line-height: 6.25em;   opacity: 0;   transition: opacity 0.5s; } .front-option:hover {   opacity: 1; } 

here jsbin of it.

the hover isn't triggering because of div placed on top. i've modified css detect hover on parent instead.

.option:hover .back-option {   opacity: 0; } 

live example: http://jsbin.com/cucadami/4/edit


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -