HTML Explanation
01
The document starts with the <!doctype html> declaration, followed by the <html> tag and a <head> section.
02
Inside the <head>, meta information ensures proper character encoding and a meaningful title is set for the page.
03
Two stylesheets are linked: one from Font Awesome for icons and another, style.css, for custom styling.
04
The <body> contains a div with the class container. Inside this container are multiple div elements with the class glass, each representing a card.
05
The style attribute on each card dynamically adjusts its rotation using a custom property (--r).
06
Each card also holds an icon (provided by Font Awesome) and a data-text attribute, which specifies the card's label like "Home," "About," etc.
07
These labels appear on hover, enhancing the interactivity.
CSS Explanation
01
The @import rule pulls in the 'Poppins' font from Google Fonts for a clean, modern look.
02
A universal selector * resets margins and padding to ensure consistency across browsers.
03
The body is styled to fill the entire viewport height with a gradient background, and Flexbox centers the content.
04
The .container aligns the glass cards centrally using Flexbox properties.
05
The .glass class defines each card's size, background gradient, and glassmorphism effect through backdrop-filter: blur(10px).
06
The hover effect changes the background color and smoothens the transition.
07
Each card also has a slight rotation applied, making them appear dynamic and interactive. When hovered, the cards straighten up and shift, creating a polished user experience.
08
Pseudo-elements like ::before are used to display the text (data-text) at the bottom of each card.
09
This text becomes visible on hover, adding another layer of interaction.
Javascript Explanation
01
The JavaScript enhances interactivity by adding click events to each card.
02
The querySelectorAll method selects all elements with the class glass.
03
An event listener is attached to each card, triggering an alert when clicked.
04
The alert displays the data-text attribute, showing which card was clicked