A modern, responsive clock built with HTML, CSS, and vanilla JavaScript.
The application combines a traditional analog clock with a digital time and date display. It demonstrates JavaScript date/time handling, DOM manipulation, CSS transforms, responsive design, and modern UI styling without relying on external frameworks.
The interface includes:
- Analog clock with hour, minute, and second hands
- Real-time digital clock
- Current date display
- Responsive clock face
- Modern dark glass-inspired interface
- Smooth hand movement and visual transitions
The analog clock dynamically calculates the rotation of each hand based on the current system time.
- Hour hand
- Minute hand
- Second hand
- Dynamically positioned clock numbers
- Smooth real-time updates
The digital display provides an easy-to-read representation of the current time alongside the analog interface.
The application also displays the current date using JavaScript's built-in date functionality.
The layout adapts to different screen sizes, allowing the clock to remain usable on desktop and mobile displays.
- HTML5
- CSS3
- JavaScript
- CSS Transforms
- CSS Custom Properties
- Responsive Design
- DOM Manipulation
- JavaScript Date API
No frameworks or external JavaScript libraries are required.
JavaScript retrieves the current time using the Date API.
The hour, minute, and second values are converted into rotation angles and applied to the corresponding clock hands using CSS transforms.
Conceptually:
Seconds → 6° per second
Minutes → 6° per minute
Hours → 30° per hour
The interface is then updated continuously to keep the analog and digital displays synchronized with the current system time.
Clone the repository:
git clone https://github.com/Nini1912/clock.gitNavigate to the project directory:
cd clockOpen:
index.html
in your browser.
No installation or build process is required.
You can also run the project using an editor extension such as Live Server.
This project helped reinforce several core frontend development concepts:
- Working with JavaScript's
DateAPI - Updating the DOM dynamically
- Calculating values for visual UI states
- Using CSS
transformandrotate() - Creating responsive layouts
- Building interfaces with CSS custom properties
- Combining JavaScript logic with CSS animations and transitions
- Structuring a small frontend project without a framework