Skip to content

Commit dad7510

Browse files
committed
Make app responsive with fluid sizing and mobile optimizations
1 parent f2aa520 commit dad7510

1 file changed

Lines changed: 42 additions & 9 deletions

File tree

style.css

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,42 @@ body {
55
align-items: center;
66
background-color: #282c34;
77
color: white;
8+
padding: 20px;
9+
min-height: 100vh;
10+
box-sizing: border-box;
811
}
912

1013
h1 {
1114
color: red;
15+
margin: 0.5em 0;
16+
font-size: clamp(1.5em, 5vw, 2.5em);
1217
}
1318

1419
.scoreboard {
1520
display: flex;
1621
justify-content: space-around;
17-
width: 300px;
22+
width: min(300px, 90vw);
1823
margin-bottom: 20px;
19-
font-size: 1.2em;
24+
font-size: clamp(1em, 3vw, 1.2em);
2025
}
2126

2227
.game-board {
2328
display: grid;
24-
grid-template-columns: repeat(3, 100px);
25-
grid-template-rows: repeat(3, 100px);
29+
grid-template-columns: repeat(3, min(100px, 25vw));
30+
grid-template-rows: repeat(3, min(100px, 25vw));
2631
gap: 5px;
32+
max-width: 90vw;
2733
}
2834

2935
.cell {
30-
width: 100px;
31-
height: 100px;
36+
width: 100%;
37+
aspect-ratio: 1;
3238
background-color: #61dafb;
3339
border: 2px solid #282c34;
3440
display: flex;
3541
justify-content: center;
3642
align-items: center;
37-
font-size: 3em;
43+
font-size: clamp(2em, 8vw, 3em);
3844
cursor: pointer;
3945
transition: background-color 0.3s;
4046
}
@@ -72,23 +78,50 @@ h1 {
7278

7379
.game-over-message {
7480
margin-top: 20px;
75-
font-size: 1.5em;
81+
font-size: clamp(1.2em, 4vw, 1.5em);
7682
color: #ff4757;
7783
height: 30px;
84+
text-align: center;
7885
}
7986

8087
#restart-button {
8188
margin-top: 20px;
8289
padding: 10px 20px;
83-
font-size: 1em;
90+
font-size: clamp(0.9em, 3vw, 1em);
8491
cursor: pointer;
8592
background-color: #61dafb;
8693
border: none;
8794
color: #282c34;
8895
border-radius: 5px;
8996
transition: background-color 0.3s;
97+
min-width: 120px;
9098
}
9199

92100
#restart-button:hover {
93101
background-color: #4a9eb4;
94102
}
103+
104+
/* Media queries for better mobile experience */
105+
@media (max-width: 480px) {
106+
body {
107+
padding: 10px;
108+
}
109+
110+
.scoreboard {
111+
width: 100%;
112+
font-size: 0.9em;
113+
}
114+
115+
.game-board {
116+
gap: 3px;
117+
}
118+
119+
.cell {
120+
border-width: 1px;
121+
}
122+
123+
#restart-button {
124+
width: 100%;
125+
max-width: 200px;
126+
}
127+
}

0 commit comments

Comments
 (0)