Ajustements adaptés à Flex Grid

La description

Si la taille explicite d'une colonne dans la grille flexible n'est pas donnée, elle redimensionnera automatiquement les colonnes. Pour les écrans plus petits, utilisez la classe .small- * . Le moyen d' élargir ou de grande expansion classe est utilisée pour développer le comportement.

Exemple

L'exemple suivant illustre l'utilisation de l' ajustement réactif dans Foundation -

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">

      <title>Foundation Template</title>
      <!-- Compressed CSS -->
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/foundation.min.css" integrity="sha256-1mcRjtAxlSjp6XJBgrBeeCORfBp/ppyX4tsvpQVCcpA= sha384-b5S5X654rX3Wo6z5/hnQ4GBmKuIJKMPwrJXn52ypjztlnDK2w9+9hSMBz/asy9Gw sha512-M1VveR2JGzpgWHb0elGqPTltHK3xbvu3Brgjfg4cg5ZNtyyApxw/45yHYsZ/rCVbfoO5MSZxB241wWq642jLtA==" crossorigin="anonymous">

      <!-- Compressed JavaScript -->
      <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/foundation.min.js" integrity="sha256-WUKHnLrIrx8dew//IpSEmPN/NT3DGAEmIePQYIEJLLs= sha384-53StQWuVbn6figscdDC3xV00aYCPEz3srBdV/QGSXw3f19og3Tq2wTRe0vJqRTEO sha512-X9O+2f1ty1rzBJOC8AXBnuNUdyJg0m8xMKmbt9I3Vu/UOWmSg5zG+dtnje4wAZrKtkopz/PEDClHZ1LXx5IeOw==" crossorigin="anonymous"></script>
   </head>

   <body>
      <h2>Example of Flex Grid</h2>

      <div class = "row">
         <div class = "small-6 large-expand columns" style = "background-color:#8BD6EE;">
            First column
         </div>

         <div class = "small-6 large-expand columns" style = "background-color:#C0B0F0;">
            Second column
         </div>

         <div class = "small-6 large-expand columns" style = "background-color:#8BD6EE;">
            Third column
         </div>

         <div class = "small-6 large-expand columns" style = "background-color:#C0B0F0;">
            Forth column
         </div>

         <div class = "small-6 large-expand columns" style = "background-color:#8BD6EE;">
            Fifth column
         </div>

         <div class = "small-6 large-expand columns" style = "background-color:#C0B0F0;">
            Sixth column
         </div>
      </div>

   </body>
</html>

Production

Exécutons les étapes suivantes pour voir comment fonctionne le code donné ci-dessus -

  • Enregistrez le code html ci-dessus responsive_adjustment.html fichier.

  • Ouvrez ce fichier HTML dans un navigateur, une sortie s'affiche comme indiqué ci-dessous.

Empilement automatique

L'empilement automatique est la classe abrégée utilisée pour le comportement d'ajustement réactif. Les classes . [Size] -unstack sont utilisées pour empiler toutes les colonnes dans une ligne par défaut, et se désempiler dans un écran plus grand.

Exemple

L'exemple suivant illustre l'utilisation de l'empilement automatique dans Foundation -

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">

      <title>Foundation Template</title>
      <!-- Compressed CSS -->
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/foundation.min.css" integrity="sha256-1mcRjtAxlSjp6XJBgrBeeCORfBp/ppyX4tsvpQVCcpA= sha384-b5S5X654rX3Wo6z5/hnQ4GBmKuIJKMPwrJXn52ypjztlnDK2w9+9hSMBz/asy9Gw sha512-M1VveR2JGzpgWHb0elGqPTltHK3xbvu3Brgjfg4cg5ZNtyyApxw/45yHYsZ/rCVbfoO5MSZxB241wWq642jLtA==" crossorigin="anonymous">

      <!-- Compressed JavaScript -->
      <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/foundation.min.js" integrity="sha256-WUKHnLrIrx8dew//IpSEmPN/NT3DGAEmIePQYIEJLLs= sha384-53StQWuVbn6figscdDC3xV00aYCPEz3srBdV/QGSXw3f19og3Tq2wTRe0vJqRTEO sha512-X9O+2f1ty1rzBJOC8AXBnuNUdyJg0m8xMKmbt9I3Vu/UOWmSg5zG+dtnje4wAZrKtkopz/PEDClHZ1LXx5IeOw==" crossorigin="anonymous"></script>
   </head>

   <body>
      <h2>Example of Flex Grid</h2>

      <div class = "row medium-unstack">
         <div class = "columns" style = "background-color:#FF6347;">First</div>
         <div class = "columns" style = "background-color:#7B68EE;">Second</div>
         <div class = "columns" style = "background-color:#FF6347;">Third</div>
         <div class = "columns" style = "background-color:#7B68EE;">Forth</div>
         <div class = "columns" style = "background-color:#FF6347;">Fifth</div>
         <div class = "columns" style = "background-color:#7B68EE;">Sixth</div>
      </div>

   </body>
</html>

Production

Exécutons les étapes suivantes pour voir comment fonctionne le code donné ci-dessus -

  • Enregistrez le code html ci-dessus automatic_stacking.html fichier.

  • Ouvrez ce fichier HTML dans un navigateur, une sortie s'affiche comme indiqué ci-dessous.