Skip to content

Commit ee39e4a

Browse files
author
guldus98
committed
html, css and js
1 parent 357d52b commit ee39e4a

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
html,body{
2+
height: 100%;
3+
margin: 0;
4+
}
5+
body{
6+
background: #262626;
7+
display: flex;
8+
flex-direction: column;
9+
justify-content: center;
10+
align-items: center;
11+
}
12+
.container{
13+
position: relative;
14+
width: 225px;
15+
height: 350px;
16+
perspective:1000px;
17+
-webkit-perspective: 1000px;
18+
border-radius: 4px;
19+
}
20+
.card {
21+
width: 100%;
22+
height: 100%;
23+
position: absolute;
24+
-webkit-transform-style: preserve-3d;
25+
transform-style: preserve-3d;
26+
transition: -webkit-transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
27+
transition: 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
28+
border-radius: 6px;
29+
box-shadow: 0 6px 16px rgba(0,0,0,.15);
30+
cursor: pointer;
31+
}
32+
.card div{
33+
position: absolute;
34+
width: 100%;
35+
height: 100%;
36+
backface-visibility: hidden;
37+
-webkit-backface-visibility: hidden;
38+
border-radius: 6px;
39+
background: #fff;
40+
display: flex;
41+
justify-content: center;
42+
align-items: center;
43+
font-size: 18px;
44+
font-family: Verdana;
45+
color: #262626;
46+
}
47+
.card .back {
48+
-webkit-transform: rotateX(180deg);
49+
transform: rotateX(180deg);
50+
}
51+
.container.active .card{
52+
-webkit-transform: rotateX(180deg);
53+
transform: rotateX(180deg);
54+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<meta charset="utf-8" />
6+
<title>page</title>
7+
<link rel="stylesheet" type="text/css" href="JavaScript Card Flip.css">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
10+
</head>
11+
<body onkeydown="keyFunction(event)">
12+
13+
<div class="container">
14+
15+
<div class="card">
16+
<div class="front word1_front">TRUECODES</div>
17+
</div>
18+
19+
<div class="card">
20+
<div class="back word1_back">CODEBLOGGER</div>
21+
</div>
22+
</div>
23+
24+
<script>
25+
26+
let box = document.querySelector(".container");
27+
box.addEventListener("click", function () {
28+
box.classList.toggle("active");
29+
});
30+
31+
function keyFunction(e) {
32+
if (e.keyCode == 38) {
33+
box.classList.add("active");
34+
};
35+
if (e.keyCode == 40) {
36+
box.classList.remove("active");
37+
};
38+
};
39+
40+
</script>
41+
42+
</body>
43+
</html>
11.9 KB
Loading

0 commit comments

Comments
 (0)