Getting Started With Foundation CSS

Here's the simplest way to get going. The straight CSS version of Foundation includes everything you need to start hacking away, right now! It's a perfect way to kickstart a new prototype or create a finished product with Foundation.


Download and Install

To get going with Foundation, simply download a default or custom CSS package from the download page.

Download Foundation CSS


Setting Up Your Project

After downloading the css files, follow these simple steps to get started:

1

First, after you unzip the package, move the folder to your desired location and open it in a text editor. If you don't have one already, we use Sublime Text here at ZURB because it's very customizable, powerful, and simply rocks.

2

The index.html is your homepage. It has been linked up with foundation.css, normalize, and all the necessary JavaScript files for you. Just add your code between the <body> tags.

3

Next, you should create a new stylesheet and link it in the header of your HTML file, like so:

<link rel="stylesheet" href="css/foundation.css"> <!-- This is how you would link your custom stylesheet --> <link rel="stylesheet" href="css/app.css"> <script src="js/vendor/modernizr.js"></script> </head>

Note: At ZURB, we call our custom stylesheets app.css. This is important for updating purposes: if you are going to add custom stylings to Foundation components, the code should be copied into your app.css file and edited there.


What You Get

When you download the Foundation CSS package, you'll receive a .zip file that contains all the things you need to get started with Foundation. Below we explain every file in detail and how you can add your custom CSS.

Stylesheets

  • foundation.css

    The default CSS for Foundation is kept here. You can find the component and its settings there. You will use this file as you are developing because it's easier to read.

  • foundation.min.css

    A minified, much smaller CSS file you can use if you don't need or want to pick apart the actual underlying Foundation CSS.

  • normalize.css

    We've included a copy of Normalize here to give you the option to remove quirks in browsers so that all webpages render elements consistently. We recommend you use this because some Foundation styles are dependant on it.

JavaScript

  • foundation.min.js

    If you are using any Foundation JavaScript components, this needs to be loaded on the page. We recommend at the end before your closing <body> tags like so:

    <script src="js/vendor/jquery.js"></script> <script src="js/foundation.min.js"></script> <script> $(document).foundation(); </script> </body>

  • /foundation

    This is a directory that contains each plugin as a single JavaScript file, so you can check out the source code. And if you'd like, include certain ones but not others, or do your own minifying.

  • /vendor

    This folder contains a few external JS files that Foundation makes use of including: Modernizr, another open-source tool from Paul Irish and Nicolas Gallagher, as well as jQuery 2.

Other

  • index.html

    This is an example index file which contains some sample markup (the grid, buttons, etc) as well as the basic structure of a responsive Foundation page. Feel free to change or destroy this file as you see fit, just bear in mind that some of the document <head> is required for the page to work including the CSS/JS that is linked up at the end of the document.

  • humans.txt

    Located in the site root just next to the robots.txt file. You don't have to use if you don't want. You can mention the developer, the designer, the copywriter, the webmaster, the SEO, SEM or SMO. Name as many people who helped make the site, or not.

  • robots.txt

    Website owners use the robots.txt file to give instructions about their site to web-crawling robots (also known as Web Wanderers, Crawlers, or Spiders). This is called The Robots Exclusion Protocol. Adding this page allows you to block web robots from indexing parts of your site. You can read more about it here.


Best Practices

We have some best practice recommendations to help you optimize your experience with the Foundation CSS package.

Making Changes to Foundation Default Stylings

In order to update your Foundation CSS when we release a new version, we recommend keeping your foundation.css file clean of any changes. Any components that you want to add your own stylings to should be copied to your app.css file where you can make changes there.

Note: be sure to link the app.css stylesheet into the <head> of your file.


HTML Page Markup

As you'll see in our index.html sample, Foundation pages have some specific markup required for them to work. This code block is a simple boilerplate for content-free Foundation pages that we hope comes in handy.

HTML

<!DOCTYPE html> <!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]--> <html class="no-js" lang="en" > <head> <meta charset="utf-8"> <!-- If you delete this meta tag World War Z will become a reality --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Foundation 5</title> <!-- If you are using the CSS version, only link these 2 files, you may add app.css to use for your overrides if you like --> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/foundation.css"> <!-- If you are using the gem version, you need this only --> <link rel="stylesheet" href="css/app.css"> <script src="js/vendor/modernizr.js"></script> </head> <body> <!-- body content here --> <script src="js/vendor/jquery.js"></script> <script src="js/foundation.min.js"></script> <script> $(document).foundation(); </script> </body> </html>
Stay on top of what’s happening in responsive design.

Sign up to receive monthly Responsive Reading highlights. Read Last Month's Edition »