純css製作炫酷流動邊框

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div></div>
	</body>
	<style>
		div{
  width: 190px;
  height: 190px;
  background: #00ff00;
  position: relative;
}

div:before,
div:after{
  position: absolute;
  content: "";
  left: -5px;
  right: -5px;
  top: -5px;
  bottom: -5px;
  border: 5px solid #FF33FF;
}
div:before{
  animation: move 5s linear infinite;
}
div:after{
  border-color: #FF33FF;
  animation: move 5s linear infinite normal -2.5s;
}

@keyframes move{
  0%,100%{
    clip: rect(0,200px,5px,0);
  }
  25%{
    clip: rect(0,200px,200px,195px);
  }
  50%{
    border-color: #00ff0088;
    clip: rect(195px,200px,200px,0);
  }
  75%{
    clip: rect(0,5px,200px,0px);
  }
}
	</style>
</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章