๐ฅ Anagram with HTML, CSS & JavaScript ๐ฎ

Do you love word games? ๐ง Want to brush up on your frontend coding while creating something fun? I built a simple yet addictive Anagram Game using plain HTML, CSS, and JavaScript โ no frameworks, no libraries, just vanilla goodness!
Letโs walk through the project and inspire you to make your own or improve this one.
๐งฉ Whatโs an Anagram?
An anagram is a word formed by rearranging the letters of another word. For example, "apple" can be turned into "papel". This game shuffles a word and asks the user to guess the original word in 3 tries!
๐ฎ How the Game Works
A random word is selected from a preset list (with fun hints! ๐)
Its letters are shuffled and shown to the player.
The player types their guess and hits Enter.
They get 3 tries, and if they're wrong, a helpful hint appears!
You can reshuffle the word if you get stuck.
Stop and restart options are available for more control.
๐ Features
๐จ Stylish UI with pastel tones and emoji hints
๐ฏ Real-time input with Enter key support
โป๏ธ Automatic word reshuffle
๐ง Score tracking
๐ Pause and restart functionality
๐ง Technologies Used
HTML for structure
CSS for the styling including button colors and font choices like Comic Sans for fun vibes
JavaScript for game logic and interactivity
๐งช Try It in Colab or Jupyter (IPython)
You can embed this in a Jupyter Notebook using:
from IPython.core.display import display, HTML
html_code = """
<!-- (Paste your full HTML code here) -->
"""
display(HTML(html_code))
Itโs a great way to combine Python environments with frontend practice!
๐ง Code Highlights
Shuffle logic:
function shuffle(str) {
return str.split('').sort(() => Math.random() - 0.5).join('');
}
Guess check and feedback:
function checkGuess() {
if (!gameActive) return;
const guess = document.getElementById("guess").value.toLowerCase().trim();
if (guess === current.word) {
// success
} else {
// show hint or game over
}
}
Keyboard integration:
document.getElementById("guess").addEventListener("keyup", function (event) {
if (event.key === "Enter") {
checkGuess();
}
});
๐ Bonus Ideas for Expansion
Want to make it more challenging or fun?
๐ Add sound effects or voice-based hints!
๐ฅ Multiplayer support
๐ Categorize by difficulty or topic
๐ Final Thoughts
This was just a fun little side project to keep my creativity flowing and test frontend fundamentals. Whether you're a beginner or an expert, small games like these can sharpen your skills and make coding joyful again.
Feel free to fork it, remix it, and share your own versions! ๐
๐ฌ Whatโs your favorite word game? Drop it in the comments! Or even better โ challenge me with an anagram !!!
Subscribe to my newsletter
Read articles from Hamna Kaleem directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
