Skip to content

Commit cff1423

Browse files
committed
Fix font and placing
1 parent 53bc7c7 commit cff1423

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

roulette-wheel.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Kids' Fun Wheel</title>
77
<link rel="stylesheet" href="styles.css">
8+
<style>
9+
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&display=swap');
10+
11+
body {
12+
height: 100dvh;
13+
overflow: hidden;
14+
}
15+
16+
#wheel-container {
17+
position: relative;
18+
display: flex;
19+
align-items: center;
20+
justify-content: center;
21+
}
22+
</style>
823
</head>
924
<body>
1025

@@ -88,13 +103,13 @@
88103
let fontSize = Math.floor(canvas.width / 10);
89104
if (labels[i].length > 2) {
90105
fontSize = Math.floor(canvas.width / 22);
91-
ctx.font = `${fontSize}px Comic Sans MS`;
106+
ctx.font = `bold ${fontSize}px Fredoka, 'Comic Sans MS', cursive`;
92107
const textWidth = ctx.measureText(labels[i]).width;
93108
if (textWidth > (radius * 0.4)) {
94109
fontSize = Math.floor(fontSize * ((radius * 0.4) / textWidth));
95110
}
96111
}
97-
ctx.font = `${fontSize}px Comic Sans MS`;
112+
ctx.font = `bold ${fontSize}px Fredoka, 'Comic Sans MS', cursive`;
98113
ctx.textAlign = "center";
99114
ctx.fillText(labels[i], 0, 0);
100115
ctx.restore();

styles.css

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&display=swap');
2+
13
* {
24
-webkit-tap-highlight-color: transparent; /* Fixes gray flash on tap */
35
}
@@ -8,20 +10,21 @@ body {
810
flex-direction: column;
911
align-items: center;
1012
justify-content: center;
11-
height: 100vh;
13+
height: 100dvh;
1214
margin: 0;
1315
background-color: #FFF9E6; /* Soft yellow background */
14-
font-family: 'Comic Sans MS', cursive, sans-serif;
16+
font-family: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;
1517
overscroll-behavior: none; /* Prevents "pull-to-refresh" bounce */
1618
-webkit-user-select: none; /* Prevents text selection popups */
1719
user-select: none;
1820
}
1921

2022
#wheel-container {
2123
position: relative;
22-
width: 500px;
23-
height: 500px;
24-
margin-bottom: 30px;
24+
width: 90vw; /* Matches the JS resize logic */
25+
max-width: 500px;
26+
height: auto;
27+
aspect-ratio: 1 / 1;
2528
}
2629

2730
canvas {

0 commit comments

Comments
 (0)