Simple interactive web app that changes a circle's color when buttons are clicked. Built with HTML, CSS, and JavaScript as a learning project for web development beginners.
A simple web application that changes the color of a circle when different buttons are clicked.
This project demonstrates the fundamentals of web development using HTML, CSS, and JavaScript. It's a hands-on approach to learning web development by building a simple interactive application.
- Change the color of a circle by clicking buttons
- Simple, responsive design
- Frontend-only implementation (no backend required)
colorify/ ├── index.html # The structure of the web page ├── index.css # The styling for the web page └── index.js # The JavaScript code for interactivity
- Clone this repository
- Open the
index.htmlfile in your web browser - Click on the colored buttons to change the circle's color
The HTML file creates the structure of our web page:
- DOCTYPE and HTML tags: Define this as an HTML5 document
- Head section: Contains metadata, title, and links to CSS and JavaScript
- Body section: Contains the visible content
- Container div: Wraps all content for styling
- Circle div: The element that changes color
- Buttons: Trigger the color change when clicked
The CSS file styles our web page:
- Body styling: Centers content and sets background color
- Container styling: Creates a card-like container with shadow
- Circle styling: Creates a perfect circle with transition effects
- Button styling: Makes buttons interactive with hover effects
- Color-specific styling: Each button has its own color scheme
The JavaScript file adds interactivity:
- paint() function: Changes the background color of the circle
- DOM manipulation: Uses getElementById to find and modify the circle
- Event handling: Responds to button clicks
If you're new to web development, here are some resources to help you understand the code:
Here are some ways to extend this project:
- Add more colors or allow custom color input
- Add animations when the color changes
- Add the ability to change the size of the circle
- Save color preferences using localStorage
This project is open source and available under the MIT License.