A simple, responsive month-view calendar built with HTML, CSS, and vanilla JavaScript.
Live preview: https://ares006-007.github.io/calendar/
- Displays current month, year, and all days laid out in a 7‑column grid.
- Previous and next icons to navigate across months dynamically.
- Highlights the current day and visually distinguishes days from previous/next months.
- Centered card layout with modern typography using the Poppins Google Font.
- Dark page background with a white calendar card and hover effects on days.
- HTML5 for structure.
- CSS3 (flexbox, box‑shadow, custom styling) for layout and design.
- Vanilla JavaScript Date API for calendar logic and month navigation.
index.html– Markup for the calendar wrapper, header (month/year + icons), and weeks/days lists.style.css– Styles for body centering, wrapper card, icons, weeks, and days with active/inactive states.script.js– Logic to render days, handle previous/next month clicks, and highlight today.
- Clone or download this repository.
- Open
index.htmldirectly in your browser, or serve via a local server (for example, VS Code Live Server). - Use the left/right icons to move between months.
- Uses
new Date()to get the current year and month. - Calculates:
- First weekday of the month
- Last date of the current month
- Last date of the previous month
- Last weekday of the current month
- Populates the
.days<ul>with<li>elements for:- Trailing days from the previous month (
inactive) - All days of the current month (with
activeon today) - Leading days from the next month (
inactive)
- Trailing days from the previous month (
- Updates the
.current-dateelement text with the month name and year using amonthsarray.
- Switch to a dark calendar card by toggling the commented
background,color, andborderlines in.wrapper. - Adjust dimensions by changing the
widthof.wrapperor font sizes of.calendar li. - Modify highlight color by changing
.days li.active::beforebackground.
This project is open for learning and personal use. Feel free to modify and integrate it into your own projects.