用css 现实打字机效果

直接写代码,真正使用注意,一个是 width的值,二是注意在不同浏览器的兼容问题。或者用gif 图片代替

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Repeated Typing Effect</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <div class="typing-effect">
    用CSS实现实现打字机效果!!!
  </div>
  
  <style>
	 @keyframes typing {
	   0% {
	     width: 0;
	   }
	   100% {
	     width: 100%;
	   }
	 }
	 
	 @keyframes blink-caret {
	   0%, 100% {
	     border-color: transparent;
	   }
	   50% {
	     border-color: black;
	   }
	 }
	 
	 .typing-effect {
	   overflow: hidden;
	   border-right: 4px solid black;
	   white-space: nowrap;
	   width: 550px;
	   max-width: 550px;
	   animation: typing 9.5s steps(40, end) forwards, blink-caret 0.75s step-end infinite;
	   animation-iteration-count: infinite; /* 让打字机效果无限重复 */
	   font-size: 35px;
		background: linear-gradient(to right, #0055ff, #00aaff);
		font-weight: 600;
	   -webkit-background-clip: text;
	   -webkit-text-fill-color: transparent;
	   	line-height: 1.5;
	 } 
  </style>
  
</body>
</html>
相关推荐
飘尘2 分钟前
让AI能够预演现实的世界模型,到底是什么?
前端·人工智能
不简说3 分钟前
JS 代码技巧 vol.3 — 10 个防抖节流深挖,小白到老炮的踩坑路
前端·javascript·面试
小智社群13 分钟前
VR漫游视频完整版
前端·javascript·音视频
小程故事多_801 小时前
拆解SOP+ReAct对话Agent,告别硬编码,解锁智能对话的柔性迭代能力
前端·人工智能·react.js·前端框架
lzjava20241 小时前
LangChain Prompt提示词工程
前端·langchain·prompt
nicole bai1 小时前
vue 自定义模块内容
前端·javascript·vue.js
清水白石0082 小时前
Python 类定义阶段自动注册子类:从 `__init_subclass__` 到插件系统实战
linux·前端·python
用户69371750013843 小时前
Kimi K3 综合能力处于全球第一梯队
android·前端·后端
anno3 小时前
Agent 新手 Skill 优先级指南:从第一套必装工作流,到专业能力补全
前端·后端
Liora_Yvonne3 小时前
前端请求层到底怎么封?为什么全局 axios 单例越用越难维护
前端