CSS transition inner div elements on div hover -
i want change opacity of text in div when hover on happens :
currently transition looks this, , moved box bit:
.bg-onebyone { transition: 0.5s ease; background: #17b6a4 none repeat scroll 0% 0% !important; } .bg-onebyone:hover { margin-top: -8px; }
in div.bg-onebyone have div holding text this
.bg-onebyone .widget-stats .stats-icon { color: #fff; opacity: 0.5; }
and want when main div hovered on want increased above opacity in transition. how can ?
<a href="/url"> <div class="widget widget-stats bg-onebyone"> <div class="stats-icon stats-icon-lg"> <i class="fa fa-search fa-fw"></i> </div> <div class="stats-desc">creating grouped unmatched aliases</div> </div> </a>
you need use :hover
pseudo-class on parent , select child element.
.bg-onebyone:hover .stats-icon { opacity: 0.8; }
also .bg-onebyone .widget-stats .stats-icon
incorrect html markup since targets .stats-icon
grand-child of .bg-onebyone
not exist.
output:
.bg-onebyone { width: 300px; height: 100px; transition: 0.5s ease; background: #17b6a4 none repeat scroll 0% 0% !important; } .bg-onebyone:hover { margin-top: -8px; } .bg-onebyone .stats-icon { color: #fff; opacity: 0.5; } .bg-onebyone:hover .stats-icon { opacity: 0.8; }
<div class="widget widget-stats bg-onebyone"> <div class="stats-icon stats-icon-lg">test text opacity <i class="fa fa-search fa-fw"></i> </div> <div class="stats-desc">creating grouped unmatched aliases</div> </div>
Comments
Post a Comment