The accent-color CSS property applies the custom accent-color for user-interface controls like ย <input type=”checkbox”>, <input type=”radio”>, <input type=”range”> and <progress> .
For Example, default color of checkbox for the following code is as follows
.task-checkbox {
width: 18px;
height: 18px;
min-width: 18px;
cursor: pointer;
}
After applying accent-color as red, it will show as follows
.task-checkbox {
width: 18px;
height: 18px;
min-width: 18px;
cursor: pointer;
accent-color: red;
}
NOTE: By default, browser choose the accent-color. if we need any specific color, we need to give it manually like above.
CSS Variables (also called Custom Properties) are one of the most powerful features in modern CSS. They help you write clean, reusable, and maintainable styles.
In this guide, youโll learn:
What CSS Variables are
Why we need them
How they work
Real-world examples
Best practices
What Are CSS Variables?
CSS Variables are custom values that you define and reuse in your CSS.
๐ They start with -- and are accessed using var().
Responsive design is no longer optional. But blindly โmaking things responsiveโ without understanding the standards often creates poor user experience.
This guide explains responsive design clearly, practically, and honestly.
What Is Responsive Design?
Responsive design means:
Designing websites that adapt smoothly to different screen sizes, devices, and orientations without breaking usability.
Itโs not just about shrinking content โ itโs about preserving intent and usability.
Why Responsive Design Is Necessary
1๏ธโฃ Users Use Multiple Devices
Mobile phones
Tablets
Laptops
Large desktops
A fixed-width site fails on most of them.
2๏ธโฃ Google Uses Mobile-First Indexing
Google evaluates:
Mobile layout
Performance
Usability
โ Non-responsive sites rank poorly.
3๏ธโฃ Accessibility & Inclusion
Larger text
Touch-friendly buttons
Screen reader compatibility
Responsive design supports everyone, not just mobile users.
Core Responsive Design Standards to Follow
1๏ธโฃ Mobile-First Design
Start designing for small screens first, then scale up.
โ Desktop-first causes clutter on mobile โ Mobile-first forces clarity
/* Mobile styles */
body { font-size: 16px; }
/* Tablet and above */
@media (min-width: 768px) {
body { font-size: 18px; }
}
2๏ธโฃ Use Fluid Layouts (Not Fixed Widths)
โ Avoid:
.container { width: 1200px; }
โ Prefer:
.container { max-width: 1200px; width: 100%; }
This allows content to adapt naturally.
3๏ธโฃ Flexible Units (rem, em, %, vw)
Unit
Use Case
rem
Font sizes
%
Containers
vw/vh
Viewport-based elements
px
Borders & icons
โ Pixel-only layouts break on different screens.
4๏ธโฃ Breakpoints Based on Content, Not Devices
โ Bad practice:
โiPhone breakpointโ
โiPad breakpointโ
โ Good practice:
Break when layout looks broken
Common starting points:
480px
768px
1024px
1280px
5๏ธโฃ Responsive Images
Images must adapt without distortion.
img {
max-width: 100%;
height: auto;
}
Use:
srcset
sizes
Modern formats (WebP)
6๏ธโฃ Touch-Friendly Design
Mobile users donโt have a mouse.
Standards to follow:
Minimum touch target: 44ร44px
Enough spacing between buttons
Avoid hover-only interactions
7๏ธโฃ Typography Responsiveness
Readable text matters more than layout.
Standards:
Base font size: 16px minimum
Line height: 1.4 โ 1.6
Limit line width to ~75 characters
Key Concepts You Must Understand
๐น Media Queries
They apply styles conditionally.
@media (min-width: 1024px) {
.layout { display: flex; }
}
๐น Flexbox & Grid
Modern layout systems replace floats.
Flexbox โ one-dimensional layouts
Grid โ two-dimensional layouts
They adapt naturally to screen changes.
๐น Viewport Meta Tag
Without this, mobile browsers scale pages incorrectly.
By using div with className(.heart) we have created heart shape
By using the div with the className(.heart-container) we have aligned the heart to the center of the page.
Heart Shape: We have created the heart by positioning two circular divs (::before and ::after) next to a square div, then rotating the main .heartdiv by -45deg.
Animation: The @keyframesbeat animation makes the heart scale up and down, creating a “beating” effect.
0%, 100%: The heart starts and ends at its original scale (1), so it returns to the original size after each beat.
50%: The heart scales up to 1.2 times its original size, creating the “pumping” effect in the middle of each beat cycle.