<!DOCTYPE html>
<html>
<head>
<title>CSS Custom Property and Media Query</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
:root {
--blue: #7ef7ed;
--white: #ffffff;
}
.container {
--fontsize: 25px;
}
/* Styles */
body {
background-color: var(--blue);
}
h2 {
border-bottom: 2px solid var(--blue);
}
.container {
color: var(--blue);
background-color: var(--white);
padding: 15px;
font-size: var(--fontsize);
}
@media screen and (min-width: 450px) {
.container {
--fontsize: 50px;
}
:root {
--blue: lightblue;
}
}
</style>
</head>
<body>
<div class="container">
<p>When the browser's width is less then 450px, the font-size of this div is 15px. When it is 450px or wider, set the --font-size variable value to 35px and the value of <b>--blue</b> variable changes to lightblue. Resize the browser window to see the effect.</p>
</div>
</body>
</html>