Problem: Adaptive Dashboard Widget and Filter Panel Visibility
Problem description
Given an HTML page structured with the following elements:
A container
<div class="dashboard-container">wrapping all elementsInside,
<aside class="sidebar">containing navigation icons and<span class="label">for each link<div class="main-content">containing:<div class="filter-panel">with input fields (collapsed by default)<button class="filter-toggle">Filter</button>(positioned floating in corners of small viewports)<section class="widgets">holding:<div class="widget-summary">—summary metrics<div class="widget-detail detail-1">—detail widget 1<div class="widget-detail detail-2">—detail widget 2<div class="widget-detail detail-3">—detail widget 3
Write CSS to satisfy the following:
Mobile (<
480px):.widgetsdisplays only.widget-summaryat full width.Hide
.widget-detail.detail-1,.widget-detail.detail-2, and.widget-detail.detail-3.Hide
.sidebar(display: none).Show
.filter-toggleas a fixed circular button at bottom-right; hide.filter-panelby default.When
.filter-togglereceives:focusor:hover, display.filter-panelas a fixed overlay covering 80% of viewport height from top.
Small tablet (
480px–767px):.widgetsshows.widget-summaryand only.widget-detail.detail-1stacked vertically (full width), hide other detail widgets.Hide
.sidebar..filter-panelappears inline above.widgets, collapsed initially (height: 0; overflow: hidden) and expands on.filter-panel:focus-withinor.filter-panel:hoverto a fixed height of200px.Hide
.filter-toggle.
Large tablet (
768px–1023px):.widgetsdisplays.widget-summaryand.widget-detail.detail-1,.widget-detail.detail-2in a two-column grid; hide.widget-detail.detail-3.Show
.sidebarcollapsed: display icons only (width: 60px; .label { display: none; })..filter-panelis inline above widgets, collapsed by default and always expanded when viewport width ≥992px, i.e.@media (min-width: 992px)sets.filter-panel { height: auto; }.Hide
.filter-toggle.
Desktop (≥
1024px):.widgetsdisplays three columns:.widget-summary,.widget-detail.detail-1,.widget-detail.detail-2, and.widget-detail.detail-3arranged in a 3×2 layout (summary spanning two rows, details filling the remaining cells).Show
.sidebarexpanded (width: 200px; .label { display: inline-block; })..filter-panelis shown inline above widgets at full width and expanded.
Goal
Implement a highly adaptive dashboard where the visibility and layout of widgets, the sidebar, and the filter panel change dynamically across four breakpoints, ensuring a seamless user experience on all devices using only CSS.
Constraints
Use only CSS; JavaScript or HTML alterations are not allowed.
Define breakpoints at exactly
480px,768px,992px, and1024px.Use CSS Grid and/or Flexbox for layout.
Use advanced selectors (
:hover,:focus,:focus-within, and:nth-child) to control visibility and dynamic expansion.Ensure the filter panel overlay on mobile is scrollable internally if content overflows.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.
Problem: Adaptive Dashboard Widget and Filter Panel Visibility
Problem description
Given an HTML page structured with the following elements:
A container
<div class="dashboard-container">wrapping all elementsInside,
<aside class="sidebar">containing navigation icons and<span class="label">for each link<div class="main-content">containing:<div class="filter-panel">with input fields (collapsed by default)<button class="filter-toggle">Filter</button>(positioned floating in corners of small viewports)<section class="widgets">holding:<div class="widget-summary">—summary metrics<div class="widget-detail detail-1">—detail widget 1<div class="widget-detail detail-2">—detail widget 2<div class="widget-detail detail-3">—detail widget 3
Write CSS to satisfy the following:
Mobile (<
480px):.widgetsdisplays only.widget-summaryat full width.Hide
.widget-detail.detail-1,.widget-detail.detail-2, and.widget-detail.detail-3.Hide
.sidebar(display: none).Show
.filter-toggleas a fixed circular button at bottom-right; hide.filter-panelby default.When
.filter-togglereceives:focusor:hover, display.filter-panelas a fixed overlay covering 80% of viewport height from top.
Small tablet (
480px–767px):.widgetsshows.widget-summaryand only.widget-detail.detail-1stacked vertically (full width), hide other detail widgets.Hide
.sidebar..filter-panelappears inline above.widgets, collapsed initially (height: 0; overflow: hidden) and expands on.filter-panel:focus-withinor.filter-panel:hoverto a fixed height of200px.Hide
.filter-toggle.
Large tablet (
768px–1023px):.widgetsdisplays.widget-summaryand.widget-detail.detail-1,.widget-detail.detail-2in a two-column grid; hide.widget-detail.detail-3.Show
.sidebarcollapsed: display icons only (width: 60px; .label { display: none; })..filter-panelis inline above widgets, collapsed by default and always expanded when viewport width ≥992px, i.e.@media (min-width: 992px)sets.filter-panel { height: auto; }.Hide
.filter-toggle.
Desktop (≥
1024px):.widgetsdisplays three columns:.widget-summary,.widget-detail.detail-1,.widget-detail.detail-2, and.widget-detail.detail-3arranged in a 3×2 layout (summary spanning two rows, details filling the remaining cells).Show
.sidebarexpanded (width: 200px; .label { display: inline-block; })..filter-panelis shown inline above widgets at full width and expanded.
Goal
Implement a highly adaptive dashboard where the visibility and layout of widgets, the sidebar, and the filter panel change dynamically across four breakpoints, ensuring a seamless user experience on all devices using only CSS.
Constraints
Use only CSS; JavaScript or HTML alterations are not allowed.
Define breakpoints at exactly
480px,768px,992px, and1024px.Use CSS Grid and/or Flexbox for layout.
Use advanced selectors (
:hover,:focus,:focus-within, and:nth-child) to control visibility and dynamic expansion.Ensure the filter panel overlay on mobile is scrollable internally if content overflows.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.