Digital Colock

Posted zhouhaocheng---yijianqinxin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Digital Colock相关的知识,希望对你有一定的参考价值。

声明:此项目来源于网络。

html代码部分

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Clock UI desgin</title>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div id="clock">
  <h2>The time is now</h2>
  <div id="time">
  <div><span id="hour">00</span> <span>Hours</span></div>
  <div><span id="Minutes">00</span> <span>Minutes</span></div>
  <div><span id="Second">00</span> <span>Second</span></div>
  </div>
</div>

<script type="text/javascript">
function clcok(){
var hours = document.getElementById('hour');
var Minutes = document.getElementById('Minutes');
var Second = document.getElementById('Second');

var h = new Date().getHours();
var m = new Date().getMinutes();
var s = new Date().getSeconds();

hours.innerHTML = h;
Minutes.innerHTML = m;
Second.innerHTML = s;
}

var interval = setInterval(clcok , 1000);

</script>
</body>

CSS部分

@import url('http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800&diaplay=swap');
*{

    margin: 0;
    padding: 0%;
    box-sizing: border-box;
    font-family: 'Open Sans' , sans-serif;
}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #060a1f;
}

#clock h2{

    position: relative;
    display: block;
    color: #ffffff;
    text-align: center;
    margin: 10px 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    font-size: 0.8em;
}

#clock #time{
    display: flex;
}

#clock #time div{
    position: relative;
    margin: 0 5px;
    -webkit-box-reflect: below 1px linear-gradient(transparent,#0004);
}

#clock #time div span{
    position:relative;
    display:block;
    width:100px;
    height:80px;
    background: #2196f3;
    color: #ffffff;
    font-weight: 300;
    display: flex;
    justify-content: center;
    font-size: 3em;
    z-index: 10;
    box-shadow: 0 0 0 1px rgba(0 , 0 , 0 , .2);
}

#clock #time div span:nth-child(2){
    height: 30px;
    font-size: 0.7em;
    letter-spacing: 0.2em;
    font-weight: 500;
    z-index: 9;
    box-shadow: none;
    background: #127fd6;
    text-transform: uppercase;
}

#clock #time div:last-child span{
    background: #ff006a;
}

#clock #time div:last-child span:nth-child(2){
    background: #ec0062;
}

显示效果:

技术图片

以上是关于Digital Colock的主要内容,如果未能解决你的问题,请参考以下文章

小车PID调试工具Serial_Digital_Scope使用笔记

小车PID调试工具Serial_Digital_Scope使用笔记

小车PID调试工具Serial_Digital_Scope使用笔记

如何在 Digital Ocean 的源代码控制中包含 nginx 和 gunicorn 配置文件?

如何隐藏 Digital Crown 滚动指示器?

Project Euler 80: Square root digital expansion