Skip to content

Commit

Permalink
added media query
Browse files Browse the repository at this point in the history
  • Loading branch information
JuneReyP committed Sep 21, 2023
1 parent dc6e5ae commit 415573e
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
/* mother element */
.container{
display: grid;
grid-template-columns: 100px 100px 100px 100px 100px;
grid-template-rows: 100px 100px 100px 100px 100px;
grid-template-columns: repeat(5, 20vw);
grid-template-rows: repeat(5, 20vh);
gap: 5px;
}

Expand Down
140 changes: 140 additions & 0 deletions md.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0px;
padding: 0px;
font-family: Verdana, Geneva, Tahoma, sans-serif;

}

body {
background-color: #5a5757;

}

.container {
display: grid;
grid-template-columns: repeat(5, 20vw);
grid-template-rows: repeat(5, 20vh);
gap: 5px;
}

.div1 {
background-color: aquamarine;
}

.div2 {
background-color: rgb(126, 54, 214);
}

.div3 {
background-color: rgb(141, 32, 108);
}

.div4 {
background-color: rgb(45, 208, 20);
}

.div5 {
background-color: rgb(228, 165, 18);
}

/* media query */
/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
.div1{
grid-column: 1/6;
grid-row: 1/2;
}
.div2{
grid-column: 1/6;
grid-row: 5/6;
}
.div3{
grid-row: 2/3;
grid-column: 1/6;
}
.div4{
grid-column: 1/6;
grid-row: 3/4;
}
.div5{
grid-column: 1/6;
grid-row: 4/5;
}
}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
.div1{
grid-column: 1/6;
grid-row: 1/2;
}
.div2{
grid-column: 1/3;
grid-row: 2/3;
}
.div3{
grid-row: 2/3;
grid-column: 3/6;
}
.div4{
grid-column: 1/3;
grid-row: 3/6;
}
.div5{
grid-column: 3/6;
grid-row: 3/6;
}
}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
.div1{
background-color: aqua;
grid-column: 1/6;
}

.div2{
background-color: rgb(67, 46, 230);
grid-row: 2/5;
grid-column: 1/2;
z-index: 1;
}

.div3{
background-color: rgb(246, 59, 162);
grid-column: 2/5;
grid-row: 2/5;
}
.div4{
background-color: rgb(103, 234, 119);
grid-row: 2/5;
grid-column: 5/6;
}
.div5{
background-color: rgb(199, 246, 59);
grid-column: 1/6;
grid-row: 5/6;
}
}
</style>
</head>

<body>
<div class="container">
<div class="div1">div1</div>
<div class="div2">div2</div>
<div class="div3">div3</div>
<div class="div4">div4</div>
<div class="div5">div5</div>
</div>
</body>

</html>

0 comments on commit 415573e

Please sign in to comment.