我想在容器悬停时对元素制作简单的动画。我不知道该怎么用CSS语法写
<article class="col-md-4 offer-box">
<div class="media">
<div class="media-left">
<i id="icon" class="fa fa-paint-brush"></i>
</div>
<div class="media-body">
<h4 class="media-heading" id="text-light">Web Design</h4>
<p class="text-muted">Pellentesque habitant
morbi tristique senectus et netus et
malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae,
ultricies eget, tempor sit amet, ante.
Donec eu libero sit amet quam egestas
semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
</div>
</div>
</article>
#icon{
color: #ef5925;
font-size: 35px;
transition-duration: 1s;
}
.offer-box:hover{
#icon{
color: #fff;
font-size: 40px;
}
}
你的css语法错误。这样写:
.offer-box:hover #icon{
color: #fff;
font-size: 40px;
}
jsFiddle: http://jsfiddle.net/AndrewL32/65sf2f66/72/