css的light-dark实现主题切换代码

代码语言:html

所属分类:布局界面

代码描述:css的light-dark实现主题切换代码

代码标签: css light-dark 主题 切换 代码

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

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

<head>
  <meta charset="UTF-8">
  


  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap");
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

body {
  line-height: 1.5;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
textarea,
select {
  font: inherit;
}

button {
  padding: 0;
  border: 0;
  border-radius: 0;
  font: inherit;
  color: inherit;
  border: 1px solid currentColor;
  background-color: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  *,
*::before,
*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
html {
  color-scheme: light dark;
}

body {
  font-family: "Geist", sans-serif;
  display: grid;
  min-height: 100dvh;
}

.theme-block {
  background-color: l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0