You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.2 KiB
HTML
59 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>game</title>
|
|
<style>
|
|
* {
|
|
padding: 0;
|
|
margin: 0;
|
|
border: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
.root {
|
|
display: grid;
|
|
grid-template-columns: repeat(var(--col,3),1fr);
|
|
border: .03em solid #000;
|
|
background-color: #FFF;
|
|
color: #000;
|
|
font-size: calc(100vw / var(--col,3) / 3);
|
|
&>div {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: calc(100vw / var(--col,3));
|
|
border: .03em solid #000;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
window.onload = ()=>{
|
|
let col = 6;
|
|
let as = [];
|
|
for(let i=1;i<=col*col;i++){
|
|
as.push(i);
|
|
}
|
|
|
|
as.sort(()=>{
|
|
return Math.random()-0.5
|
|
})
|
|
|
|
let root = document.querySelector(".root");
|
|
root.setAttribute("style","--col:"+col);
|
|
for(let a of as){
|
|
let d = document.createElement("div");
|
|
d.textContent = a;
|
|
root.appendChild(d);
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="root">
|
|
</div>
|
|
|
|
</body>
|
|
</html> |