grid和flexbox布局实现定时器码表效果代码

代码语言:html

所属分类:布局界面

代码描述:grid和flexbox布局实现定时器码表效果代码

代码标签: 布局 实现 定时器 码表 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">

<style>
:root {
  --hue: 220;

  --surface-1: hsl(var(--hue) 6% 12%);
  --surface-2: hsl(var(--hue) 5% 30%);
  --text-1:    hsl(var(--hue) 10% 90%);
  --text-2:    hsl(var(--hue) 10% 80%);
  --brand-1:   hsl(var(--hue) 50% 67%);
}

html {
  height: 100%;
  width: 100%;
  background: hsl(220, 6%, 18%);
  background: hsl(var(--hue) 6% 18%);
  color: hsl(220, 10%, 90%);
  color: var(--text-1);
}

body {
  min-height: 100%;
  min-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 2rem;

  display: grid;
  align-content: center;
  -webkit-box-pack: center;
          justify-content: center;
  place-content: center;
  grid-gap: 2ch;
  gap: 2ch;

  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
}

.timer {
  max-width: 40ch;
  display: grid;
  grid-gap: 3rem;
  gap: 3rem;
  padding: 2rem;
  background: hsl(220, 6%, 12%);
  background: var(--surface-1);
  box-shadow:
    0 2.8px 2.2px hsla(0, 0%, 0%, 0.02),
    0 6.7px 5.3px hsla(0, 0%, 0%, 0.027999999999999997),
    0 12.5px 10px hsla(0, 0%, 0%, 0.035),
    0 22.3px 17.9px hsla(0, 0%, 0%, 0.042),
    0 41.8px 33.4px hsla(0, 0%, 0%, 0.05),
    0 100px 80px hsla(0, 0%, 0%, 0.07);
  border: 1px solid hsl(220, 5%, 30%);
  border: 1px solid var(--surface-2);
  border-radius: 5px
}

.timer > hr {
    width: 100%;
    border: none;
    border-bottom: 1px solid hsl(220, 5%, 30%);
    border-bottom: 1px solid var(--surface-2);
  }

.timer > footer {
    display: grid;
    -webkit-box-align: center;
            align-items: center;
    justify-items: center;
    place-items: center;
  }

header {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: [icon-start] 3rem [title] 1fr [icon-end] 3rem;
  -webkit-box-align: center;
          align-items: center
}

header > h1 {
    grid-area: title;
    margin: 0;
    text-align: center;
    font-weight: 500;
    font-size: 1.25rem;
  }

header > .icon:first-of-type {
    grid-area: icon-start;
  }

header > .icon:last-of-type {
    grid-area: icon-end;
  }

.icon {
  width: 1.5rem;
  height: 1.5rem
}

.icon > svg {
    fill: hsl(220, 10%, 80%);
    fill: var(--text-2);
    height: 100%;
  }

time {
  font-size: 3rem;
  font-weight: 400;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: hsl(220, 50%, 67%);
  color: var(--brand-1);

  display: -webkit-box;

  display: flex;
  justify-content: space-around;
  -webkit-box-align: center;
          align-items: center
}

time > span {
    display: -webkit-box;
    display: flex;
    -webkit-box-align: baseline;
            align-.........完整代码请登录后点击上方下载按钮下载查看

网友评论0