This is a clean, responsive and interactive Rock, Paper, Scissors game built using HTML, CSS, and JavaScript. It's a beginner-friendly project showcasing dynamic DOM manipulation, styling techniques, and user interaction logic.
🔗 Live Preview: Click to Play
- Dynamic DOM selection and updates with
document.querySelector()andgetElementById() - Conditional logic to determine game outcomes
- Responsive design with media queries
- UI/UX feedback using background color changes
- Display toggling for screens using
.style.display - Using
clamp()andvwfor font responsiveness
✅ Player vs Computer logic
✅ Score Tracking
✅ Name Input for Personalization
✅ Result Message + Color Feedback
✅ Reset / End / Restart buttons
✅ Responsive Layout for Mobile Screens
✅ Modern UI with Gradient Background
📁 Rock-Paper-Scissors/
├── index.html # Main game structure and script
├── style.css # All styles (or inline in <style>)
├── script.js # JS logic
document.getElementById("player").innerHTML = `${name} : ${score_p}`;
document.querySelector(".play").style.display = "block";This is used to update score, switch screens, and show/hide components dynamically.
if (computer === option) {
// It's a tie
} else if (
(computer === 'rock' && option === 'scissor') ||
...
) {
// Computer wins
} else {
// Player wins
}Simple but effective logic to determine winners using conditionals.
@media (max-width: 479px) {
.startScreen {
flex-wrap: wrap;
}
h1 {
font-size: 6vw;
}
}Uses mobile-first responsive design, improving usability across screen sizes.
document.getElementById("result").style.backgroundColor = 'green'; // win
document.getElementById("result").style.backgroundColor = 'red'; // loseInstant feedback on the result enhances user engagement.
- Clone the repo or download files
- Open
index.htmlin your browser - Enter your name and start playing!
- Add sound effects
- Animate buttons or result card
- Add score limit to auto-end game
- Add emoji icons for Rock 🪨, Paper 📄, Scissors ✂️
- Add confetti on win using
canvas-confetti
- HTML5
- CSS3 (Flexbox, Gradients, Media Queries)
- JavaScript (DOM Manipulation, Event Handling)
Made by [Muhammad Saad Abbasi] 🔗 GitHub Profile 📬 Feel free to star the repo or share feedback!