gpt4 book ai didi

javascript - 创建移动的文本装饰

转载 作者:行者123 更新时间:2023-11-28 16:39:33 25 4
gpt4 key购买 nike

我如何制作像this这样的移动文字装饰?查看当用户将鼠标悬停在“关于”、“公司”、“博客”上时,线条会移动。知道如何创建它吗?谢谢:)

最佳答案

使用 CSS3 动画:

HTML:

<div id="test">
<h2>Some title</h2>
<p>Lorem ipsum dolor sit amet, omnesque accusata pro ei. Ex vocibus pertinax facilisis mei, sit verterem adolescens ea. Ut ius tota tritani. Sumo rebum conclusionemque et usu. Duo deleniti delicata ei. Est magna graeci in, ludus officiis efficiendi ius ex.</p>

CSS:

#test {
display:block;
background:url('http://launchpad.la/wp-content/themes/launchpad-la/resources/css/images/nav-retina-red.png') repeat-x;
width:200px;
height:3px;
}
#test:hover {
animation:move 3s ease-in infinite;
-webkit-animation:move 3s ease-in infinite;
-moz-animation:move 3s ease-in infinite;
-ms-animation:move 3s ease-in infinite;
}
@keyframes move {
from{background-position:0px 0px;}
to {background-position:1000px 0px;}
}
@-webkit-keyframes move {
from{background-position:0px 0px;}
to {background-position:1000px 0px;}
}
@-moz-keyframes move {
from{background-position:0px 0px;}
to {background-position:1000px 0px;}
}
@-ms-keyframes move {
from{background-position:0px 0px;}
to {background-position:1000px 0px;}
}

这是一个 FIDDLE

关于javascript - 创建移动的文本装饰,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23304914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com