Learn RWD
Create responsive websites that work on all devices using media queries and mobile-first design.
0 of 10 concepts completed (0%)
What You'll Learn
Tutorial Contents
1.Media Queries & Breakpoints
Mobile-first means writing base styles for small screens, then adding complexity at larger breakpoints.
/* Base styles mobile (no prefix) */
.card {
display: flex;
flex-direction: column;
padding: 1rem;/* Tablet 768px and up */ @media (min-width: 768px) { .card { flex-direction: row; gap: 1.5rem; } }
/* Desktop 1024px and up */ @media (min-width: 1024px) { .card { padding: 2rem; gap: 2rem; } }
/* Standard breakpoints (Tailwind-inspired) */ /* sm: 640px larger phones / landscape */ /* md: 768px tablets */ /* lg: 1024px laptops */ /* xl: 1280px desktops */ /* 2xl: 1536px wide monitors */
/* Targeting specific range */ @media (min-width: 640px) and (max-width: 767px) { .sidebar { display: none; } }
/* Print styles */ @media print { .navbar, .footer { display: none; } body { font-size: 12pt; } } ```
2.Fluid Layouts & Responsive Images
/* Fluid container */
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;/* Responsive grid no media queries needed */ .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
/* Fluid typography with clamp */ h1 { font-size: clamp(1.75rem, 5vw, 3.5rem); } p { font-size: clamp(1rem, 2vw, 1.25rem); }
/* Responsive images */ img { max-width: 100%; height: auto; display: block; }
/* Responsive video (16:9) */ .video-wrapper { position: relative; padding-bottom: 56.25%; /* 9/16 */ height: 0; overflow: hidden; } .video-wrapper iframe { position: absolute; inset: 0; width: 100%; height: 100%; } ```
3.Touch-Friendly Design
/* Touch targets minimum 44x44px */
button, a, input, select {
min-height: 44px;
min-width: 44px;/* Avoid hover-only interactions on touch */ @media (hover: hover) { .card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); } }
/* Prevent tap highlight on mobile */ button, a { -webkit-tap-highlight-color: transparent; }
/* Sticky header on scroll */ header { position: sticky; top: 0; z-index: 100; backdrop-filter: blur(8px); }
/* Safe area insets (iPhone notch) */ .app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); } ```
Code Example
/* Mobile-first approach */
.button {
width: 100%;
padding: 12px;
font-size: 16px;
}
/* Tablet */
@media (min-width: 768px) {
.button {
width: auto;
padding: 10px 20px;
}
}
/* Desktop */
@media (min-width: 1024px) {
.button {
padding: 12px 24px;
font-size: 18px;
}
}Pro Tips
- 1Write CSS mobile-first (min-width queries). Starting from the smallest screen and scaling up is far easier than trying to shrink a desktop layout.
- 2Use CSS clamp() for truly fluid typography: clamp(1rem, 2.5vw, 2rem) no breakpoints needed.
- 3Test on real devices, not just browser DevTools. Touch targets, fonts, and scroll behaviour differ significantly.
- 4The viewport meta tag is mandatory: without it, mobile browsers scale your page down to fit your media queries won't fire.
Topics Covered
Continue Learning
Explore the official documentation and deepen your knowledge with real-world practice.
Explore the Full Portfolio
This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.
The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.
For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.