Home Responsive titles and media query
Post
Cancel

Responsive titles and media query

Example from class:

HTML

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!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" />
    <link rel="stylesheet" href="./style.css" />
    <title>Responsiveness</title>
  </head>
  <body>
    <h1>This title is responsive!</h1>

    <div class="box"></div>
  </body>
</html>

CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
h1 {
  font-size: calc(1.5rem + 3vw);
}

.box {
  height: 100px;
  width: 100px;
  background-image: linear-gradient(to bottom, red 0%, black 33%, yellow 100%);
}

@media (width > 600px) {
  .box {
    height: 200px;
  }
}

@media (600px < width < 650px) {
  .box {
    width: 200px;
  }
}
This post is licensed under CC BY 4.0 by the author.