首页htmlmediaCSS Layout - 如何根据浏览器大小更改标签颜色

CSS Layout - 如何根据浏览器大小更改标签颜色

我们想知道如何根据浏览器大小更改标签颜色。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.topbar {
  background-color: green
}

@media screen and (min-width: 1250px) {
  .topbar {
    background-color: red
  }
}
</style>
</head>
<body>
  <div class="topbar">The top bar</div>
</body>
</html>