Problem: Responsive Testimonial Carousel and Grid Visibility
Problem description
Given an HTML page with a testimonial section containing two main elements:
A
<div class="testimonial-carousel">that wraps multiple<div class="testimonial-item">elements (each containing.testimonial-textand hidden.author-photo)A
<div class="testimonial-grid">that wraps multiple<div class="testimonial-item">elements (each containing.testimonial-textand an<img class="author-photo" src="...">, hidden by default)
Write CSS to ensure the layout adapts responsively across three breakpoints: mobile, tablet, and desktop.
Mobile view (viewport width less than
600px):The
.testimonial-carouselcomponent should be visible.The
.testimonial-gridcomponent should be hidden.Inside
.testimonial-carousel, the.author-photoelement must remain hidden, ensuring a simplified layout for smaller screens.
Tablet view (viewport width between
600pxand899px):The
.testimonial-gridcomponent should be visible and arranged into two columns for balanced readability.The
.testimonial-carouselcomponent should be hidden to avoid duplication.Within
.testimonial-grid, the.author-photoelement must continue to remain hidden for a cleaner, more compact display.
Desktop view (viewport width
900pxand above):The
.testimonial-gridcomponent should be visible and arranged into three columns, making use of the wider screen real estate.The
.author-photoelement should now be displayed, adding visual depth to the testimonials.The
.testimonial-carouselcomponent should remain hidden.
Goal
Implement a testimonial section that provides a swipeable carousel on mobile, a two-column grid on tablet, and a three-column grid with photos on desktop, enhancing user engagement and readability across devices.
Constraints
Only use CSS; do not modify HTML or use JavaScript.
Breakpoints are exactly
600pxand900px.The
.testimonial-carouseland.testimonial-gridelements should occupy the same container space, but only one is visible at a time.Grid gaps should be
16pxon tablet and24pxon desktop..author-photoelements are hidden by default and only shown on desktop within.testimonial-grid.
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: Responsive Testimonial Carousel and Grid Visibility
Problem description
Given an HTML page with a testimonial section containing two main elements:
A
<div class="testimonial-carousel">that wraps multiple<div class="testimonial-item">elements (each containing.testimonial-textand hidden.author-photo)A
<div class="testimonial-grid">that wraps multiple<div class="testimonial-item">elements (each containing.testimonial-textand an<img class="author-photo" src="...">, hidden by default)
Write CSS to ensure the layout adapts responsively across three breakpoints: mobile, tablet, and desktop.
Mobile view (viewport width less than
600px):The
.testimonial-carouselcomponent should be visible.The
.testimonial-gridcomponent should be hidden.Inside
.testimonial-carousel, the.author-photoelement must remain hidden, ensuring a simplified layout for smaller screens.
Tablet view (viewport width between
600pxand899px):The
.testimonial-gridcomponent should be visible and arranged into two columns for balanced readability.The
.testimonial-carouselcomponent should be hidden to avoid duplication.Within
.testimonial-grid, the.author-photoelement must continue to remain hidden for a cleaner, more compact display.
Desktop view (viewport width
900pxand above):The
.testimonial-gridcomponent should be visible and arranged into three columns, making use of the wider screen real estate.The
.author-photoelement should now be displayed, adding visual depth to the testimonials.The
.testimonial-carouselcomponent should remain hidden.
Goal
Implement a testimonial section that provides a swipeable carousel on mobile, a two-column grid on tablet, and a three-column grid with photos on desktop, enhancing user engagement and readability across devices.
Constraints
Only use CSS; do not modify HTML or use JavaScript.
Breakpoints are exactly
600pxand900px.The
.testimonial-carouseland.testimonial-gridelements should occupy the same container space, but only one is visible at a time.Grid gaps should be
16pxon tablet and24pxon desktop..author-photoelements are hidden by default and only shown on desktop within.testimonial-grid.
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.