小菜今天看到网上有个css3的打字动画,觉得不错就给收藏下来了。下面是demo

1.html结构

<h1>瓦力的博客 http://waliblog.com</h1>

2.css样式

@keyframes typing {
	from {
	  width:0;
  }
}
@keyframes blink-caret {
	50% {
	border-color:transparent;
  }
}

h1 {
  /* # of 字体颜色渐变 # of chars */
  color: #f35626;
	background-image: -webkit-linear-gradient(92deg,#f35626,#feab3a);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
  
	font:bold 200% Consolas,Monaco,monospace;
	border-right:.1em solid;
	width:16.5em;
	/* fallback */
	width:30ch;
	/* # of chars */
	margin:2em 1em;
	white-space:nowrap;
	overflow:hidden;
	animation:typing 3s steps(30,end),/* # of steps = # of chars */
		 blink-caret .5s step-end infinite alternate,
     hue 60s infinite linear;
}

@-webkit-keyframes hue {
  from {
    -webkit-filter: hue-rotate(0deg);
  }

  to {
			-webkit-filter: hue-rotate(-360deg);
		  }
}

css 相关

input 中checkbox样式 PC端适配屏幕尺寸 css3 打字渐变效果 css3 模拟正负条形图 css3 美化滚动条 css 颜色值 css3 border 圆角 渐变 css 纯css tooltips