Skip to content

Commit

Permalink
Add item-13
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-vo committed Dec 12, 2024
1 parent c777756 commit 5c6c183
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 0 deletions.
111 changes: 111 additions & 0 deletions practice-vault/beginner/item-13/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!doctype html>
<html lang="en">
<head>
<title>Item 13</title>
<style>
body {
background: #0e0e0e;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
text-align: center;
}

.input {
height: 50px;
font-size: 30px;
text-align: center;
border-radius: 0;
padding: 0;
margin-right: 10px;
border: none;
box-shadow: 0 0 10px orangered;
}

.button {
border-radius: 20px;
background-color: #333;
color: #fff;
border: none;
padding: 10px 40px;
font-size: 24px;
margin-top: 20px;
}

.equal-text {
font-size: 30px;
color: #fff;
margin-right: 10px;
}

.result {
margin-top: 20px;
font-size: 30px;
color: orangered;
}
</style>
</head>
<body>
<div class="container">
<div>
<label>
<input
type="number"
class="input first-number"
placeholder="1st number"
/>
</label>
<label>
<select class="input operator">
<option value="plus">Plus</option>
<option value="minus">Minus</option>
<option value="divide">Divide by</option>
<option value="time">Time</option>
</select>
</label>
<label>
<input
type="number"
class="input second-number"
placeholder="2nd number"
/>
</label>
<label>
<span class="equal-text">=</span>
<input type="number" class="input result" readonly />
</label>
</div>
<div>
<button class="button" onclick="calculate()">Calculate</button>
</div>
<script>
function calculate() {
let firstNumber = Number(
document.querySelector('.first-number').value,
);
let secondNumber = Number(
document.querySelector('.second-number').value,
);
let operator = document.querySelector('.operator').value;
let result;

if (operator === 'plus') {
result = firstNumber + secondNumber;
} else if (operator === 'divide') {
result = firstNumber / secondNumber;
} else if (operator === 'time') {
result = firstNumber * secondNumber;
} else if (operator === 'minus') {
result = firstNumber - secondNumber;
}

document.querySelector('.result').value = result;
}
</script>
</div>
</body>
</html>
70 changes: 70 additions & 0 deletions practice-vault/beginner/item-14/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mysterious Box</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
text-align: center;
}
.box {
width: 200px;
height: 200px;
background: #fff
url('https://gifdb.com/images/thumbnail/bouncing-gift-box-o19ltvr8ldanpz66.gif')
no-repeat center/cover;
margin: 20px auto;
display: flex;
justify-content: center;
align-items: center;
}

.opened {
background: #fff
url('https://media0.giphy.com/media/QYkViQRNkpS1Sgx0js/giphy.gif')
no-repeat center/cover;
}

.hidden {
display: none;
}

.gif1 {
background-image: url('https://example.com/gif1.gif');
background-size: cover;
}

.gif2 {
background-image: url('https://example.com/gif2.gif');
background-size: cover;
}

.gif3 {
background-image: url('https://example.com/gif3.gif');
background-size: cover;
}
</style>
</head>
<body>
<div class="container">
<div class="box opened">
<img
src="https://cdn.startselect.com/production/products/images/64f47/63003/2758668536-180x180.png?id=5cc5342b38a719aa92798e891ff5c291"
/>
<img
src="https://cdn.creazilla.com/cliparts/7820941/electric-scooter-clipart-xl.png"
/>
</div>
<button id="revealButton">Reveal the Mystery!</button>
</div>
</body>
</html>

0 comments on commit 5c6c183

Please sign in to comment.