Skip to content

Commit 5b02b09

Browse files
authored
Merge pull request #38 from Sayanti2003/main
Create Dice.html
2 parents db8f7f6 + 4d81e16 commit 5b02b09

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

Dice.html

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!DOCTYPE html>
2+
<html lang="en" dir="ltr">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Dicee Game 🎲</title>
6+
7+
<!-- Google Fonts -->
8+
<link href="https://fonts.googleapis.com/css?family=Indie+Flower|Lobster" rel="stylesheet" />
9+
10+
<!-- Internal CSS -->
11+
<style>
12+
.container {
13+
width: 70%;
14+
margin: auto;
15+
text-align: center;
16+
}
17+
18+
.dice {
19+
text-align: center;
20+
display: inline-block;
21+
}
22+
23+
body {
24+
background-color: #393e46;
25+
}
26+
27+
h1 {
28+
margin: 30px;
29+
font-family: 'Lobster', cursive;
30+
text-shadow: 5px 0 #232931;
31+
font-size: 8rem;
32+
color: #4ecca3;
33+
}
34+
35+
p {
36+
font-size: 2rem;
37+
color: #4ecca3;
38+
font-family: 'Indie Flower', cursive;
39+
}
40+
41+
img {
42+
width: 80%;
43+
}
44+
45+
footer {
46+
margin-top: 5%;
47+
color: #eeeeee;
48+
text-align: center;
49+
font-family: 'Indie Flower', cursive;
50+
}
51+
</style>
52+
</head>
53+
54+
<body>
55+
<div class="container">
56+
<h1>Refresh Me</h1>
57+
58+
<div class="dice">
59+
<p>Player 1</p>
60+
<img class="img1" src="https://raw.githubusercontent.com/AppBrewery/dicee/master/images/dice6.png" />
61+
</div>
62+
63+
<div class="dice">
64+
<p>Player 2</p>
65+
<img class="img2" src="https://raw.githubusercontent.com/AppBrewery/dicee/master/images/dice6.png" />
66+
</div>
67+
</div>
68+
69+
<footer>www 🎲 App Brewery 🎲 com</footer>
70+
71+
<!-- Internal JavaScript -->
72+
<script>
73+
var random1 = Math.floor(Math.random() * 6) + 1;
74+
var image1 = "https://raw.githubusercontent.com/AppBrewery/dicee/master/images/dice" + random1 + ".png";
75+
document.querySelector(".img1").setAttribute("src", image1);
76+
77+
var random2 = Math.floor(Math.random() * 6) + 1;
78+
var image2 = "https://raw.githubusercontent.com/AppBrewery/dicee/master/images/dice" + random2 + ".png";
79+
document.querySelector(".img2").setAttribute("src", image2);
80+
81+
if (random1 > random2) {
82+
document.querySelector("h1").innerHTML = "🚩 Player 1 Wins!";
83+
} else if (random1 < random2) {
84+
document.querySelector("h1").innerHTML = "Player 2 Wins! 🚩";
85+
} else {
86+
document.querySelector("h1").innerHTML = "Draw!";
87+
}
88+
</script>
89+
</body>
90+
</html>

0 commit comments

Comments
 (0)