fervor [>]CODING & CURIOSITY
FERVOR LEARNING SYSTEMTUTORIALS
← CSS

CSS / 2 MIN READ

Responsive Design

Learn techniques for creating layouts that adapt to different screen sizes.

From the original Fervor library. Examples may use older package versions.

To make a responsive design for a React app with this code, you can use media queries in CSS to adjust the styling based on the screen size.

Here are some steps you can follow to make the design responsive:

  1. Define breakpoints for different screen sizes based on your design requirements. For example, you can use the following breakpoints:
  • Small screens: up to 576px width
  • Medium screens: 576px to 992px width
  • Large screens: 992px to 1200px width
  • Extra-large screens: above 1200px width
  1. Use CSS media queries to apply different styles for each breakpoint. For example, you can add the following media queries to adjust the font size and layout for small screens:
@media only screen and (max-width: 576px) {
  :root {
    font-size: 2vh;
  }
  .home-container {
    max-width: 100vw;
  }
  .header {
    grid-template-columns: 10vw 70vw 10vw;
  }
  .card-container {
    width: 90vw;
  }
}

This media query adjusts the font size to 2vh and sets the maximum width of the home container to 100vw for small screens. It also changes the grid template columns for the header and reduces the width of the card container to 90vw.

  1. Use flexible units such as vw, vh, and em to define sizes and distances. These units adjust based on the screen size, making the design responsive.

  2. Test the design on different screen sizes to ensure it looks good and functions properly.

You can add more media queries to adjust the design for different screen sizes and make it more responsive. Keep in mind that responsive design requires careful planning and testing to ensure the best user experience across all devices.

Keep your curiosity going.Explore more CSS →
287 TUTORIALS · 22 TOPICSREADY