Open In App

Foundation CSS Default Media Queries

Last Updated : 16 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Foundation CSS is an open-source & responsive front-end framework built by the ZURB foundation in September 2011, which makes it easy to design beautiful responsive websites, apps, and emails that look amazing & can be accessible to any device. The framework is built on SaaS-like bootstrap. It is more sophisticated, flexible, and easily customizable. It also comes with CLI, so it’s easy to use it with module bundlers. It offers the Fastclick.js tool for faster rendering on mobile devices. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is built on SaaS-like bootstrap. It is more sophisticated, flexible, and easily customizable. It also comes with CLI, so it’s easy to use it with module bundlers. It offers the Fastclick.js tool for faster rendering on mobile devices.

Foundation CSS Media Queries include media features such as width, height, color, and display the content as per the specified screen resolution. In short, this feature makes the responsive design actually work.

Default Media Queries: Foundation uses the following default media queries which are the three core breakpoints:

  • small: This media query breakpoint class is true for any screen.
  • medium: This media query breakpoint class is true for screens of 640 pixels and wider.
  • large: This media query breakpoint class is true for screens of 1024 pixels and wider.

However, many components can be modified at different screen sizes using special breakpoint classes. One of the most common examples can be the grid. In the following code, the left-hand column is six columns wide on small screens, hence .small-6. On medium-sized screens, the class .medium-4 overrides the small style and thus changing the column to be four columns wide.

Syntax:

<div class="grid-x grid-margin-x">
  <div class="cell small-6 medium-4">...</div>
</div>

CSS Version: If you’re using the CSS version of Foundation CSS, you must use the following media queries to follow the core breakpoints:

/* Small only */
@media screen and (max-width: 39.9375em) {}
/* Medium and up */
@media screen and (min-width: 40em) {}
/* Medium only */
@media screen and (min-width: 40em) and (max-width: 63.9375em) {}
/* Large and up */
@media screen and (min-width: 64em) {}
/* Large only */
@media screen and (min-width: 64em) and (max-width: 74.9375em) {}

Example 1:

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
  <title>Foundation CSS Default Media Queries</title>
  <!-- Compressed CSS -->
  <link rel="stylesheet"
        href=
  
  <!-- Compressed JavaScript -->
  <script src=
  </script>
  
  <script src=
  </script>
</head>
  
<body style="padding:2rem 1rem;">
  <center>
    <h1 style="color:green;">GeeksforGeeks</h1>
    <h3>Foundation CSS Default Media Queries</h3>
    <div class="grid-x grid-margin-x">
      <div class="cell small-6 medium-4">
        Helloworld This is line 01.
      </div>
      <div class="cell small-6 medium-4">
        Helloworld This is line 02.
      </div>
      <div class="cell small-6 medium-4">
        Helloworld This is line 03.
      </div>
      <div class="cell small-6 medium-4">
        Helloworld This is line 04.
      </div>
      <div class="cell small-6 medium-4">
        Helloworld This is line 05.
      </div>
      <div class="cell small-6 medium-4">
        Helloworld This is line 06.
      </div>
    </div>
  </center>
  
  <script>
    $(document).foundation();
  </script>
</body>
  
</html>


Output:

Foundation CSS Default Media Queries

Foundation CSS Default Media Query

Example 2:

HTML




<!DOCTYPE html>
<html lang="en">
<head>
  <title>Foundation CSS Default Media Queries</title>
  <!-- Compressed CSS -->
  <link rel="stylesheet" 
        href=
  <!-- Compressed JavaScript -->
  <script src=
  </script>
  <script src=
  </script>
</head>
  
<body style="padding:2rem 1rem;">
  <center>
    <h1 style="color:green;">GeeksforGeeks</h1>
    <h3>Foundation CSS Default Media Queries</h3>
    <div class="grid-x grid-margin-x">
      <div class="cell small-2 medium-8">
        Helloworld This is line 01.
      </div>
      <div class="cell small-2 medium-8">
        Helloworld This is line 02.
      </div>
      <div class="cell small-2 medium-8">
        Helloworld This is line 03.
      </div>
      <div class="cell small-2 medium-8">
        Helloworld This is line 04.
      </div>
      <div class="cell small-2 medium-8">
        Helloworld This is line 05.
      </div>
      <div class="cell small-2 medium-8">
        Helloworld This is line 06.
      </div>
    </div>
  </center>
  <script>
    $(document).foundation();
  </script>
</body>
  
</html>


Output:

Foundation CSS Default Media Queries

Foundation CSS Default Media Query

Reference: https://get.foundation/sites/docs/media-queries.html#default-media-queries



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads