我需要创建一个按钮,当悬停时,它不仅要从底部到顶部填充背景颜色,还要从底部到顶部更改文本颜色。
我可以使用这个方法: CSS:悬停时背景从底部到顶部填充:
但它还必须从底部到顶部更改内部文本颜色。
<style>
a {
background-image: linear-gradient(to top, yellow 50%, transparent 50%);
background-size: 100% 200%;
background-position: top;
transition: background-position 0.5s ease-in-out; /** I've changed the time for demo purposes **/
color: black;
}
a:hover {
background-position: bottom;
}
</style>
<a href="#">I'm a link</a>
<a href="#">I'm another link</a>
这是我需要的截图: 这里是截图链接!