css实现中性暗黑和亮色模式时钟效果代码
代码语言:html
所属分类:其他
代码描述:css实现中性暗黑和亮色模式时钟效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="Description" content="A Simple Analog Clock"> <meta name="theme-color" content="#091921"> <link rel="stylesheet" href="CSS/main.css"> <style> @import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap'); * { margin: 0; padding: 0; box-sizing: border-box; } body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #090909; background: #07141b; } body.light { background: #d1dae3; } .clock { width: 375px; height: 375px; display: flex; justify-content: center; align-items: center; background: url(//repo.bfw.wiki/bfwrepo/icon/61d42b3bc557d.png); background-size: cover; border: 4px; /* box-shadow: 15px 15px 15px rgba(255, 255, 255, 0.5); */ box-shadow: 0em -1.2em 1.2em rgba(255, 255, 255, 0.06), inset 0em -1.2em 1.2em rgba(255, 255, 255, 0.06), 0em 1.2em 1.2em rgba(0, 0, 0, 0.3), inset 0em 1.2em 1.2em rgba(0, 0, 0, 0.3); border-radius: 50%; } body.light .clock { box-shadow: 0em -1.2em 1.2em rgba(255, 255, 255, 0.3), inset 1em 1em -1em rgba(255, 255, 255, 0.3), 0em -1.2em -1.2em rgba(0, 0, 0, 0.5), inset 1em -1em 1em rgba(0, 0, 0, 0.1); } .clock :hover { /* yet to be completed; when hovered, diplay complete information about time, `new Date().toLocaleString();` */ cursor: pointer; } /* The small circle int the center */ .clock:before { content: ''; position: absolute; width: 15px; height: 15px; background: rgb(255, 255, 255); border-radius: 50%; /* The z-index property specifies the stack order of an element. /* An element with greater stack order is always in front of an element with a lower stack order. */ /* Note: z-index only works on positioned elements (position: absolute, position: relative, position: fixed, or position: sticky). */ z-index: 10000; /* kept as a high value, since wanted at top */ } body.light .clock:before { background: #1a74be; } .clock .hour, .clock .min, .clock .sec { position: absolute; } /* length of respective arms; */ .clock .hour, .hr { width: 160px; height: 160px; } .clock .min, .mn { width: 190px; height: 190px; } .clock .sec, .sc { width: 230px; height: 230px; } .hr, .mn, .sc { display: flex; justify-content: center; /* align-items: center; */ position: absolute; border-radius: 50%; } ..........完整代码请登录后点击上方下载按钮下载查看
网友评论0