纯css实现元素下出现横线动画(background-image)

时间:2018-12-05 19:52:36   收藏:0   阅读:202

效果图:

技术分享图片

html:

<div class=‘site_bar‘>首页</div>

css:

.site_bar{

  background-image : linear-gradient(red,red);

  background-position : center bottom;

  background-size : 0 2px;

  background-repeat : no-repeat;  //这个属性不能少。

  transition : .3s;

}

.site_bar:hover{

  background-size : 100% 2px;

}

原文:https://www.cnblogs.com/zhucj/p/10072480.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!