Short Tutorial: Creating a Counter App with HTML, CSS, and JavaScript

Posted by

Tutorial Counter App

body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.counter {
text-align: center;
}
button {
padding: 8px 16px;
margin: 0 8px;
font-size: 16px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}

Counter App

Click the buttons to increase or decrease the count:

Count: 0


let count = 0;
const countElement = document.getElementById(‘count’);

function increaseCount() {
count++;
countElement.textContent = count;
}

function decreaseCount() {
count–;
countElement.textContent = count;
}

0 0 votes
Article Rating
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@codingasik
5 months ago

Belajar di Course JWD -> https://bagascodingasik.com