250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- hover
- IOS
- 비전공자
- 애니메이션
- 프론트엔드
- keyframes
- 백엔드
- HTML
- php
- xcode
- react
- CSS
- SWIFT
- ipad
- 풀스택
- javascript
- 개발자
- iOS 개발자
- front-end
- button
- 비전공 개발자
- effect
- Animation
- html5
- iPhone
- 자바스크립트
- image
- css3
- jQuery
- MAC
Archives
- Today
- Total
비전공자 개발일기
Mario Matching Game 본문
728x90
SMALL
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=`, initial-scale=1.0">
<title>MARIO MATCHING GAME</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h2>Mario Matching Game</h2>
<div class="box">
<label>
<input type="checkbox" class="checkbox" id="chk1">
<i></i>
</label>
<label>
<input type="checkbox" class="checkbox" id="chk2">
<i></i>
</label>
<label>
<input type="checkbox" class="checkbox" id="chk3">
<i></i>
</label>
</div>
<button class="reset">Reset Game</button>
<script>
let chk1 = document.querySelector("#chk1");
let chk2 = document.querySelector("#chk2");
let chk3 = document.querySelector("#chk3");
let reset = document.querySelector(".reset");
chk1.onclick = function() {
if(chk1.checked === true ) {
chk1.disabled = true;
}
}
chk2.onclick = function() {
if(chk2.checked === true ) {
chk2.disabled = true;
}
}
chk3.onclick = function() {
if(chk3.checked === true ) {
chk3.disabled = true;
}
}
reset.onclick = function() {
chk1.disabled = false;
chk1.checked = false;
chk2.disabled = false;
chk2.checked = false;
chk3.disabled = false;
chk3.checked = false;
}
</script>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 100vh;
}
h2 {
margin-bottom: 30px;
font-size: 2.5em;
}
.box {
position: relative;
width: 600px;
height: 200px;
border-bottom: 2px solid #555;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.box label {
position: relative;
width: 100%;
height: 33.3333%;
border: 2px solid #555;
border-bottom: none;
}
.box label input {
position: relative;
appearance: none;
z-index: 10;
}
.box label i {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: 600px;
}
.box label:nth-child(1) i {
background-image: url(01.jpg);
animation: animate .5s steps(3) infinite;
}
.box label:nth-child(2) i {
background-image: url(02.jpg);
animation: animate .4s steps(3) infinite;
}
.box label:nth-child(3) i {
background-image: url(03.jpg);
animation: animate .7s steps(3) infinite;
}
@keyframes animate {
0% {
background-position: 0;
}
100% {
background-position: 600px;
}
}
.box label input:checked ~ i {
animation-play-state: paused;
}
.reset {
margin-top: 40px;
font-size: 1.25em;
border: none;
padding: 10px 25px;
background-color: #333;
color: #FFF;
}
.reset:active {
background-color: #D63C3C;
transform: scale(0.95);
}
728x90
LIST
'HTML _CSS' 카테고리의 다른 글
Paper (0) | 2022.09.08 |
---|---|
Rader Loading Animation (0) | 2022.09.07 |
Oxygen (0) | 2022.09.05 |
Wave BG Button (0) | 2022.09.04 |
Tabs Using (0) | 2022.09.03 |