发布时间:2025-12-10 13:10:38 浏览次数:23
今天我们要分享一些HTML炫酷特效代码,这些代码可以让你的网页更加生动、有趣,引起用户的兴趣和注意。首先是一个有趣的“文字打印”的效果,让你的文字一个一个地出现在页面上:
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>文字打印特效</title><style>.typing-effect{text-align:center;font-size:2em;}.typing-effect span{animation:typing 4s steps(15, end);}@keyframes typing{from{width: 0}to{width:100%} }</style></head><body><p ><span>Hello World!</span></p></body></html>下一个特效是一个简单的文本移动,让你的文字像是在“滑行”:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>文本移动特效</title><style>.slide-text{position:relative;overflow:hidden;display:inline-block;}.slide-text span{position:absolute;top:0;left:-100%;animation:slide 8s infinite;}@keyframes slide{0%{left:-100%;}50%{left:100%;}100%{left:100%;}}</style></head><body><p ><span>This is a sliding text.</span></p></body></html>最后一个特效是让你的图片或文字随着鼠标移动而移动,营造出立体的效果:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>3D鼠标移动特效</title><style>.move-3d{perspective:500px;}.move-3d img,.move-3d h1{position:relative;width:250px;}.move-3d img{transition:all .3s ease-out;}.move-3d img:hover{transform:rotateY(15deg);}.move-3d h1:before{content:"";position:absolute;width:50%;height:100%;background:black;opacity:.5;left:-50%;top:0;z-index:-1;transition:all .3s ease-out;}.move-3d h1:hover:before{left:0;}.move-3d h1:after{content:"";position:absolute;width:100%;height:50%;background:black;opacity:.5;left:0;top:-50%;z-index:-1;transition:all .3s ease-out;}.move-3d h1:hover:after{top:0;}</style></head><body><p ><img src="image.jpg"><h1>This is a 3D moving text.</h1></p></body></html>以上是三个炫酷特效的HTML代码分享。希望这些代码能够为你的网页增添更多有趣的元素。