Skip to content

Instantly share code, notes, and snippets.

@modster
Forked from prof3ssorSt3v3/index.html
Created April 24, 2023 05:18
Show Gist options
  • Save modster/12a895b8aed4864b08ec8866a998cd5b to your computer and use it in GitHub Desktop.
Save modster/12a895b8aed4864b08ec8866a998cd5b to your computer and use it in GitHub Desktop.
Code from video on color-scheme and prefers-color-scheme
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>color-scheme and prefers-color-scheme</title>
<meta name="color-scheme" content="light dark" />
<style>
/* no css yet */
/*
:root {
color-scheme: dark light;
}
*/
h2 {
color-scheme: light dark;
}
@media screen and (prefers-color-scheme: dark) {
* {
/* color: gold; */
}
h2 {
color: gold;
background-color: #222;
padding: 0.5rem 2rem;
}
}
</style>
</head>
<body>
<header>
<h1>CSS color-scheme property</h1>
<h2>CSS prefers-color-scheme media query</h2>
</header>
<main>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas in
blanditiis optio molestias soluta sequi accusamus perspiciatis incidunt
illo, dolorem quisquam veniam, ipsam qui et deserunt similique doloribus
beatae eum!
</p>
</main>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment