<div>
<p>In dark mode, I'll be pink!</p>
</div>
body {
  background: white;
  font-weight: 'bold';
  text-align: center;
}

div {
  background: rgba(0,0,0,0.1);
  border-radius: 10px;
  padding: 20px;
  margin: 0 auto;
  max-width: 400px;
}

p {
  font-family: sans-serif;
  font-weight: 600;
  text-transform: uppercase;
}

@media(prefers-color-scheme: dark) {
  body {
    background-color: #000;
  }
  div {
    background-color: rgba(255,255,255,0.1);
  }
  p {
    color: hotpink;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.