Open In App

Foundation CSS Menu Active State

Improve
Improve
Like Article
Like
Save
Share
Report

Foundation CSS is an open-source and responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails that look amazing and can be accessible to any device. 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.

A Menu in Foundation CSS is a navigation list that contains the different components that redirect to the various linked pages in the websites or web applications. Active State in the case of the menu means that it marks the element as an active page.

Foundation CSS Menu Active State Classes:

  • is-active: This class is used on any <li> item to create an active state element which thus marks it as an active page.

Syntax:

<ul class ="menu">
    <li class="is-active"><a>....</a></li>
    <li>....</li>    
</ul>

Example 1: This is a basic example illustrating Active State made using Foundation CSS.

HTML




<!DOCTYPE html>
  
<html lang="en">
<head>
    <title>Foundation CSS Menu Active State</title>
    <!-- Compressed CSS -->
    <link rel="stylesheet"
          href=
    <!-- Compressed JavaScript -->
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <center>
        <h1 style="color:green;">GeeksforGeeks</h1>
        <strong>Foundation CSS Menu Active State</strong>
    </center>
    <ul class="menu">
         <li class="is-active"><a>Home</a></li>
         <li><a>Data Structures</a></li>
         <li><a>Algorithms</a></li>
         <li><a>Fundamentals</a></li>
         <li><a>About Us</a></li>
    </ul>
    <script>
        $(document).foundation();
    </script>
</body>
</html>


Output:

Foundation CSS Menu Active State

Foundation CSS Menu Active State

Example 2: This is a basic example illustrating a vertical active state created by using Foundation CSS.

HTML




<!DOCTYPE html>
  
<html lang="en">
<head>
    <title>Foundation CSS Menu Active State</title>
    <!-- Compressed CSS -->
    <link rel="stylesheet"
          href=
    <!-- Compressed JavaScript -->
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <center>
        <h1 style="color:green;">GeeksforGeeks</h1>
        <strong>Foundation CSS Menu Active State</strong>
    </center>
    <ul class="menu vertical">
         <li class="is-active"><a>Home</a></li>
         <li><a>Data Structures</a></li>
         <li><a>Algorithms</a></li>
         <li><a>Fundamentals</a></li>
         <li><a>About Us</a></li>
    </ul>
    <script>
        $(document).foundation();
    </script>
</body>
</html>


Output:

Foundation CSS Menu Active State

Foundation CSS Menu Active State

Example 3: This is a basic example illustrating a nested vertical active state created using Foundation CSS.

HTML




<!DOCTYPE html>
  
<html lang="en">
<head>
    <title>Foundation CSS Menu Active State</title>
    <!-- Compressed CSS -->
    <link rel="stylesheet"
          href=
    <!-- Compressed JavaScript -->
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <center>
        <h1 style="color:green;">GeeksforGeeks</h1>
        <strong>Foundation CSS Menu Active State</strong>
    </center>
     <ul class="menu vertical">
        <li class="is-active"><a>Home</a></li>
        <li><a>Data Structures</a></li>
            <ul class="nested vertical menu">
                <li><a href="#">Linked List</a></li>
                <li><a href="#">Stack</a></li>
                <li><a href="#">Queue</a></li>
                <li><a href="#">Trees</a></li>
            </ul>
        <li><a>Algorithms</a></li>
        <li><a>Fundamentals</a></li>
        <li><a>About Us</a></li>
    </ul>
    <script>
        $(document).foundation();
    </script>
</body>
</html>


Output:

Foundation CSS Menu Active State

Foundation CSS Menu Active State

Reference: https://get.foundation/sites/docs/menu.html



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