Open In App

Foundation CSS Dropdown Positioning

Improve
Improve
Like Article
Like
Save
Share
Report

Foundation CSS is an open-source and responsive front-end framework created by ZURB in September 2011 that makes it simple to create stunning responsive websites, apps, and emails that operate on any device. Many companies, like Facebook, eBay, Mozilla, Adobe, and even Disney, use it. This framework is based on bootstrap, which is similar to SaaS. It’s more complex, versatile, and configurable. It also comes with a command-line interface, making it simple to use with module bundlers. Email framework provides you with responsive HTML emails, which can be read on any device. Foundation for Apps allows you to build fully responsive web applications.

Dropdown is used to display the content when we click the element. We can put any type of content in the dropdown and access it by clicking the element. Dropdown Positioning is used to position the dropdown. In this article, we will discuss how to position the dropdown in Foundation CSS.

Foundation CSS Dropdown Positioning Classes:

  • top: It is used to position the dropdown at the top of the element.
  • bottom: It is used to position the dropdown at the bottom of the element.
  • left: It is used to position the dropdown at the left of the element.
  • right: It is used to position the dropdown at the right of the element.

Syntax:

<div class="dropdown-pane POSITION" data-dropdown>
  ......
</div>

Example 1: The following code demonstrates the Dropdown Positioning left and right.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Foundation CSS Dropdown Positioning</title>
    <!-- Compressed CSS -->
    <link rel="stylesheet" 
          href=
          crossorigin="anonymous">
    
    <!-- Compressed JavaScript -->            
    <script src=
    </script>
    <script src=
            crossorigin="anonymous">
    </script>
</head>
<body style="padding: 1%;">    
   <center>
      <h2 style="color: green;">
          GeeksforGeeks
      </h2>
      <h3>Foundation CSS Dropdown Positioning</h3>
  
      <button class="button"
              type="button" 
              data-toggle="dropdown-left">
        Dropdown Position Left
      </button>
      <div class="dropdown-pane left"
           id="dropdown-left" 
           data-dropdown>
        A Computer Science portal for geeks. 
        It contains well written, well thought and well 
        explained computer science and programming articles
      </div>
      <br> <br> <br>
        <button class="button" 
                type="button" 
                data-toggle="dropdown-right">
          Dropdown Position Right
      </button>
      <div class="dropdown-pane right"
           id="dropdown-right"
           data-dropdown>
        A Computer Science portal for geeks. 
        It contains well written, well thought and
        well explained computer science and 
        programming articles
      </div>
    </center>
    <script>
         $(document).ready(function() {
         $(document).foundation();  })
    </script>
</body>
</html>


Output:

Foundation CSS Dropdown Positioning

Foundation CSS Dropdown Positioning

Example 2:  The following code demonstrates the Dropdown Positioning top and bottom.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Foundation CSS Dropdown Positioning</title>
    <!-- Compressed CSS -->
    <link rel="stylesheet" 
          href=
          crossorigin="anonymous">
    
    <!-- Compressed JavaScript -->            
    <script src=
    </script>
    <script src=
            crossorigin="anonymous">
    </script>
</head>
<body style="padding: 1%;">    
   <center>
      <h2 style="color: green;">GeeksforGeeks</h2>
      <h3>Foundation CSS Dropdown Positioning</h3>
  
      <button class="button"
              type="button" 
              data-toggle="dropdown-top">
        Dropdown Position Top
      </button>
      <div class="dropdown-pane top"
           id="dropdown-top" 
           data-dropdown>
        A Computer Science portal for geeks. 
        It contains well written,
        well thought and well explained computer
        science and programming articles
      </div>
      <br>
        <button class="button"
                type="button"
                data-toggle="dropdown-bottom">
          Dropdown Position Bottom</button>
      <div class="dropdown-pane bottom" 
           id="dropdown-bottom" 
           data-dropdown>
        A Computer Science portal for geeks. 
        It contains well written,
        well thought and well explained computer
        science and programming articles
      </div>
    </center>
    <script>
      $(document).ready(function() {
      $(document).foundation(); })
    </script>
</body>
</html>


Output:

Foundation CSS Dropdown Positioning

Foundation CSS Dropdown Positioning

Reference: https://get.foundation/sites/docs/dropdown.html#positioning



Last Updated : 28 Feb, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads