JavaScript,css时间计时器
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
#time{
width: 600px;
height: 200px;
font-size: 60px;
text-align: center;
margin: 0 auto;
top:200px;
background: linear-gradient(to bottom left,#e74335 0%,#299b49 100%);
-webkit-background-clip: text;
color: transparent;
position: relative;
}
</style>
</head>
<body>
<div id="time"></div>
<script type="text/javascript">
function dateTimes(){
var date = new Date()
var hour = date.getHours()
var min= date.getMinutes()
var sec = date.getSeconds()
if(min<=9){
min = "0"+min
}
if(sec<=9){
sec = "0"+sec
}
return hour+":"+min+":"+sec
}
function times(){
document.getElementById("time").innerHTML = dateTimes()
}
setInterval(times,1000)
</script>
</body>
</html>