Skip to content

Commit 4996d6e

Browse files
added responsive styles
1 parent ec84ca6 commit 4996d6e

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Game {
1414
drawSquare(arr) {
1515
let htmlData = `
1616
<h1>15 puzzle</h1>
17-
<table class="square-wrapper"><tr>`;
17+
<table class="square-wrapper"><tbody><tr>`;
1818

1919
for (let i = 0; i < arr.length; i++) {
2020
if (arr[i] !== null) {
@@ -24,7 +24,7 @@ class Game {
2424
}
2525
}
2626

27-
htmlData += `</tr></table>`;
27+
htmlData += `</tr></tbody></table>`;
2828

2929
return this.data.innerHTML = htmlData;
3030
}

index.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
<head>
55
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
67
<title>Puzzle 15</title>
78
<link rel="icon" type="image/x-icon" href="img/favicon.ico">
89
<link rel="apple-touch-icon-precomposed" href="img/little-penguin-152-27563.png">

styles.css

+22
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ td.cell {
6767
box-sizing: border-box;
6868
height: 114px;
6969
padding: 12px 15px;
70+
font-size: 40px;
7071
}
7172

7273
.cell:hover {
@@ -84,4 +85,25 @@ td.cell {
8485

8586
.no-events {
8687
pointer-events: none;
88+
}
89+
90+
91+
@media (max-width: 600px) {
92+
div.container {
93+
width: 100%;
94+
}
95+
96+
.square-wrapper {
97+
max-width: 100vw;
98+
max-height: unset;
99+
height: 100vw;
100+
}
101+
102+
td.cell {
103+
line-height: 22vw;
104+
height: 22vw;
105+
font-size: 10vw;
106+
padding: 0;
107+
margin: 2px;
108+
}
87109
}

0 commit comments

Comments
 (0)