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.
Foundation CSS and JavaScript can be used for programmatic use in an HTML document by including the necessary CSS and JavaScript files and initializing the plugins.
To include the necessary CSS and JavaScript files, you can either download them from the Foundation website and link to them locally, or you can link to them from a CDN (Content Delivery Network).
In order to use Foundation JavaScript, we can add the necessary HTML attributes to elements and initialize the relevant plugins. We can use the data-toggle attribute to toggle a dropdown menu, or the data-responsive-accordion-tabs attribute to create responsive tabs.
In order to use Foundation CSS, we can apply the various CSS classes to the HTML elements. We can use the button class to style a button, or the grid-x class to create a grid layout.
To initialize the Foundation plugins, we can call the foundation() function on the document object when the page is loaded.
Syntax:
<script>
$(document).foundation();
</script>
Example 1: This code of Foundation CSS and JavaScript is for programmatic use in an HTML document.
This example uses Foundation's dropdown JavaScript plugin to toggle a dropdown menu when the button is clicked.
The dropdown menu is created using the dropdown-pane class and the data-dropdown attribute. The data-toggle attribute on the button element is used to specify the ID of the dropdown element that should be toggled.