Skip to main content

Overview

The Dev Showcase portfolio implements a comprehensive responsive design strategy using CSS media queries to adapt layouts and interactions across all device sizes. Location: wwwroot/css/responsive.css

Responsive Strategy

Mobile-First Approach

The application uses a mobile-first design philosophy:
  1. Base styles: Optimized for mobile devices
  2. Progressive enhancement: Additional features for larger screens
  3. Media queries: Add complexity as viewport increases

Fluid Layouts

Layouts use:
  • Flexible grids with CSS Grid and Flexbox
  • Percentage-based widths
  • max-width constraints
  • Viewport-relative units (vw, vh)

Breakpoints

The application defines five main responsive breakpoints:
BreakpointWidthTarget Devices
Desktop Large> 1200pxLarge desktops, wide monitors
Desktop1025px - 1200pxStandard desktops, laptops
Tablet769px - 1024pxTablets landscape, small laptops
Mobile Large481px - 768pxTablets portrait, large phones
Mobile≤ 480pxSmall phones

Media Query Breakpoints

1200px and Below

@media (max-width: 1200px)
Target: Large tablets and smaller desktops

Layout Changes

Projects Layout:
.projects-layout {
    grid-template-columns: 1fr; /* Stack to single column */
}
Carousel Cards:
.carousel-card {
    flex: 0 0 calc(33.333% - 8px); /* Show 3 cards on large tablets */
}
Grid Adjustments:
.vocational-bars-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
}

.logos-grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
}

.interactive-panels-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
}

1024px and Below

@media (max-width: 1024px)
Target: Tablets and below Sidebar Behavior:
.sidebar {
    transform: translateX(-100%); /* Hide off-screen */
    width: 280px;
}

.sidebar.active {
    transform: translateX(0); /* Slide in when active */
}
Main Content:
.main-wrapper {
    margin-left: 0 !important; /* Full width */
}
Mobile Menu:
.menu-toggle {
    display: flex; /* Show hamburger menu */
}

.menu-overlay {
    display: block; /* Enable overlay */
}

.menu-overlay.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

Component Adjustments

Language Selector:
.language-selector {
    top: 80px; /* Move down to avoid menu button */
}
Project Info:
.project-info {
    grid-template-columns: 1fr; /* Stack project details */
}
Grids:
.vocational-grid-lists,
.proyecto-top-grid {
    grid-template-columns: 1fr; /* Single column */
}

768px and Below

@media (max-width: 768px)
Target: Large phones and small tablets

Header Adjustments

.header-particles {
    height: 300px; /* Reduce header height */
}

.header-content h1 {
    font-size: 2rem; /* Smaller main heading */
}

.header-content h2 {
    font-size: 1.25rem; /* Smaller subheading */
}

Typography

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.35rem;
}

Layout

.main-content {
    padding: 1.5rem; /* Reduce padding */
}

Grids

.vocational-bars-grid {
    grid-template-columns: 1fr; /* Single column */
}

.logos-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
}

.interactive-panels-grid {
    grid-template-columns: 1fr; /* Single column */
    gap: 1.5rem;
}

Filters

.skill-filter,
.project-filter,
.education-filter,
.vocational-section-filter {
    flex-direction: column; /* Stack buttons vertically */
}

.filter button,
.vocational-section-btn {
    width: 100%; /* Full width buttons */
    text-align: center;
}
.carousel-card {
    flex: 0 0 calc(50% - 6px); /* Show 2 cards */
}

.carousel-arrow {
    width: 40px; /* Smaller arrows */
    height: 40px;
}

.carousel-arrow.left {
    left: -15px;
}

.carousel-arrow.right {
    right: -15px;
}

Certificates

.certificates-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

Chart Legends

.radar-legend,
.cognitive-legend {
    grid-template-columns: 1fr; /* Single column legends */
}

640px and Below

@media (max-width: 640px)
Target: Small tablets
.logos-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns for tech logos */
}

480px and Below

@media (max-width: 480px)
Target: Mobile phones
.sidebar {
    width: 100%; /* Full width sidebar on mobile */
}

Positioning

.language-selector {
    right: 10px; /* Reduce margin */
    top: 70px;
}
.header-particles {
    height: 250px; /* Further reduce height */
}

.header-content h1 {
    font-size: 1.5rem; /* Smallest heading size */
}

.header-content h2 {
    font-size: 1rem; /* Smallest subheading */
}

Layout

.main-content {
    padding: 1rem; /* Minimal padding */
}

Panels

.glow-panel {
    padding: 1.5rem;
    min-height: 150px; /* Reduce height */
}

.glow-panel .icon {
    font-size: 2rem; /* Smaller icons */
}

Statistics

.stat-bar-container {
    height: 10px; /* Thinner progress bars */
}

Logos

.logos-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
}

.logo-text span {
    font-size: 1rem; /* Smaller text */
}
.carousel-card {
    flex: 0 0 100%; /* One card at a time */
}

Projects

.projects-block {
    padding: 1rem; /* Reduce padding */
}

Charts

.chart-container {
    height: 300px; /* Reduce chart height */
}

.chart-container-bar {
    height: 250px; /* Reduce bar chart height */
}

Certificates

.certificates-grid {
    grid-template-columns: 1fr; /* Single column */
}

Typography

.project-info-card h2 {
    font-size: 1.5rem;
}

.project-info-card h3 {
    font-size: 1.25rem;
}

Modals

.modal-content {
    max-width: 95%; /* Nearly full width */
}

.modal-close-btn {
    top: -45px;
    width: 35px;
    height: 35px;
}

Touch vs Desktop Interactions

Touch Device Detection

@media (hover: none) and (pointer: coarse)
Target: Touch-only devices (phones, tablets)

Glow Panels

.glow-panel::before {
    opacity: 0.5; /* Always show partial glow on touch devices */
}
Reason: No hover state on touch devices
.carousel-arrow {
    opacity: 0.8; /* Always visible on touch devices */
}
Reason: No hover to reveal on touch devices

Desktop (> 1024px)

  • Sidebar always visible
  • Fixed position on left
  • Main content offset by sidebar width
  • No hamburger menu
  • No overlay

Tablet/Mobile (≤ 1024px)

  • Sidebar hidden by default (transform: translateX(-100%))
  • Hamburger menu button visible
  • Click menu to slide in sidebar
  • Dark overlay covers main content
  • Click overlay or navigation item to close
  • Body scroll locked when menu open
JavaScript Implementation (main.js:7-37):
function toggleMenu() {
    sidebar.classList.toggle('active');
    menuToggle.classList.toggle('active');
    menuOverlay.classList.toggle('active');
    document.body.style.overflow = sidebar.classList.contains('active') ? 'hidden' : '';
}

// Auto-close on resize to desktop
window.addEventListener('resize', () => {
    if (window.innerWidth > 1024 && sidebar.classList.contains('active')) {
        sidebar.classList.remove('active');
        menuToggle.classList.remove('active');
        menuOverlay.classList.remove('active');
        document.body.style.overflow = '';
    }
});

Touch Support:
  • touchstart / mousedown: Begin drag
  • touchmove / mousemove: Track finger/mouse position
  • touchend / mouseup: Complete drag, snap to slide
Drag Behavior:
  • Minimum 5px movement to activate drag (prevents accidental drags on tap)
  • Minimum 50px drag to trigger slide change
  • Smooth animation on release
  • Prevents default scroll during horizontal drag
Multi-input Support:
getPositionX(event) {
    return event.type.includes('mouse') ? event.pageX : event.touches[0].clientX;
}

Click vs Drag Detection

touchEnd() {
    if (!this.hasMoved) {
        // Handle as click
        return;
    }
    // Handle as drag
}
Prevents card click handlers from firing during drags.

Layout Changes by Viewport

Grid Transformations

Projects Layout

  • > 1200px: 2-column layout
  • ≤ 1200px: 1-column stacked

Vocational Bars Grid

  • > 1200px: 3 columns
  • 1025px - 1200px: 2 columns
  • ≤ 768px: 1 column

Tech Logos Grid

  • > 1200px: 4+ columns (auto-fit)
  • 769px - 1200px: 3 columns
  • 481px - 768px: 2 columns
  • ≤ 480px: 2 columns

Interactive Panels Grid

  • > 1200px: 3+ columns
  • 769px - 1200px: 2 columns
  • ≤ 768px: 1 column
  • > 1200px: 2.1 cards (partial 3rd visible)
  • 481px - 768px: 2 cards (1.1 in JS)
  • ≤ 480px: 1 card at a time

Responsive Images

Base Styles (base.css:89-93)

img {
    max-width: 100%;
    height: auto;
    display: block;
}
Benefits:
  • Images never overflow container
  • Maintain aspect ratio
  • No inline gaps (block display)

Responsive Typography

Font sizes scale down on smaller viewports:
ElementDesktop768px480px
h12.5rem2rem1.5rem
h22rem1.75rem-
h31.5rem1.35rem-
Header h1-2rem1.5rem
Header h2-1.25rem1rem

Best Practices Applied

1. Mobile-First CSS

Base styles target mobile, enhancements for larger screens:
/* Base: Mobile styles */
.element {
    width: 100%;
    padding: 1rem;
}

/* Enhancement: Desktop */
@media (min-width: 1025px) {
    .element {
        width: 50%;
        padding: 2rem;
    }
}

2. Fluid Grids

Use CSS Grid with auto-fit and minmax():
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

3. Flexible Images

All images scale with container:
img {
    max-width: 100%;
    height: auto;
}

4. Touch-Friendly Targets

Buttons and interactive elements sized for touch:
.carousel-arrow {
    width: 50px;  /* Desktop */
    height: 50px;
}

@media (max-width: 768px) {
    .carousel-arrow {
        width: 40px;  /* Touch-friendly size */
        height: 40px;
    }
}

5. Content-First Breakpoints

Breakpoints chosen based on when content needs adjustment, not device sizes.

6. Progressive Enhancement

Core functionality works on all devices, enhancements for capable devices:
  • Base: Touch navigation works everywhere
  • Enhancement: Hover effects on desktop
  • Enhancement: Glow panels follow mouse on desktop

Testing Responsive Design

Browser DevTools

Chrome/Edge:
  1. Open DevTools (F12)
  2. Click device toolbar icon (Ctrl+Shift+M)
  3. Select device or custom dimensions
  4. Test touch events with “Toggle device mode”
Firefox:
  1. Open DevTools (F12)
  2. Click Responsive Design Mode (Ctrl+Shift+M)
  3. Test various viewports

Test Different Breakpoints

Key widths to test:
  • 1920px (desktop)
  • 1200px (breakpoint)
  • 1024px (tablet/mobile toggle)
  • 768px (mobile large)
  • 480px (mobile)
  • 360px (small phones)

Test Interactions

  • Resize browser window to trigger responsive changes
  • Test menu toggle at 1024px breakpoint
  • Test carousel touch drag on mobile simulation
  • Test hover effects with mouse vs touch

  • wwwroot/css/responsive.css: All responsive styles
  • wwwroot/css/base.css: Base styles and variables
  • wwwroot/js/main.js: Responsive menu JavaScript
  • wwwroot/js/carousel.js: Touch-enabled carousel

Build docs developers (and LLMs) love