Erlo

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

2018-12-05 19:02:16 发布   568 浏览  
页面报错/反馈
收藏 点赞

效果图:

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;

}

登录查看全部

参与评论

评论留言

还没有评论留言,赶紧来抢楼吧~~

手机查看

返回顶部

给这篇文章打个标签吧~

棒极了 糟糕透顶 好文章 PHP JAVA JS 小程序 Python SEO MySql 确认