JSFiddle - React, Tailwind, and code Playground
by Mylastwish
HTML
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>HTML5 Puzzel met Afbeeldingslink</title>
<style>
* {
box-sizing: border-box;
user-select: none;
-webkit-user-select: none;
touch-action: none;
}
body {
margin: 0;
padding: 0;
background-color: #1e1e24;
font-family: sans-serif;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
width: 100vw;
}
#ui {
margin-bottom: 10px;
color: white;
z-index: 10;
}
button {
padding: 10px 20px;
font-size: 16px;
background-color: #ff4757;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
button:active {
transform: scale(0.95);
}
#canvas-container {
position: relative;
width: 95vw;
height: 80vh;
max-width: 800px;
max-height: 600px;
background: #2f3542;
border-radius: 8px;
box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="ui">
<button id="resetBtn">Husselen</button>
</div>
<div id="canvas-container">
<canvas id="puzzleCanvas"></canvas>
</div>
<script>
const canvas =...