zurb-foundation-5
Version:
Foundation 5 for npm (no code modification from original repo)
185 lines (153 loc) • 7.88 kB
HTML
---
title: Getting Started With Foundation CSS
---
<h3 class="subheader">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.</h3>
***
### Download and Install
To get going with Foundation, simply download a default or custom CSS package from the download page.
<a href="/develop/download.html" class="button">Download Foundation CSS</a>
<hr>
<div class="row">
<div class="small-12 path-container columns">
<h2>Setting Up Your Project</h2>
<h2 class="subheader">After downloading the css files, follow these simple steps to get started:</h2>
<div class="row path-item">
<div class="circlenumber">
<h3>1</h3>
</div>
<p>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 <a href="http://www.sublimetext.com/">Sublime Text</a> here at ZURB. It's powerful and free.</p>
</div>
<div class="row path-item">
<div class="circlenumber">
<h3>2</h3>
</div>
<p>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.</p>
</div>
<div class="row path-item">
<div class="circlenumber">
<h3>3</h3>
</div>
<p>Next, you should create a new stylesheet and link it in the header of your HTML file, like so:</p>
{{#markdown}}
```
<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>
```
{{/markdown}}
<p class="subheader note"><strong>Note:</strong> 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.</p>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="small-12 columns">
<h2>What You Get</h2>
<h3 class="subheader">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. </h3>
</div>
</div>
<div class="row">
<div class="medium-6 columns">
<div class="header-container">
<h3>Stylesheets</h3>
</div>
<ul class="info-list">
<li>
<strong>foundation.css</strong>
<p>The default CSS for Foundation is kept here. You can find the component and and its settings there. You will use this file as you are developing because it's easier to read.</p>
</li>
<li>
<strong>foundation.min.css</strong>
<p>A minified, much smaller CSS file you can use if you don't need or want to pick apart the actual underlying Foundation CSS.</p>
</li>
<li>
<strong>normalize.css</strong>
<p>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.</p>
</li>
</ul>
<div class="header-container">
<h3>JavaScript</h3>
</div>
<ul class="info-list">
<li>
<strong>foundation.min.js</strong>
<p>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:
{{#markdown}}
```html
{{> examples_css_javascript_include}}
```
{{/markdown}}
</p>
</li>
<li>
<strong>/foundation</strong>
<p>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.</p>
</li>
<li>
<strong>/vendor</strong>
<p>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.</p>
</li>
</ul>
</div>
<div class="medium-6 columns">
<div class="header-container">
<h3>Other</h3>
</div>
<ul class="info-list">
<li><strong>index.html</strong><p>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.</p></li>
<li><strong>humans.txt</strong><p>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.</p></li>
<li><strong>robots.txt</strong><p>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 <a href="http://zurb.us/1jixgzu">here</a>.</p></li>
</ul>
</div>
</div>
<hr>
<div class="row">
<div class="small-12 path-container columns">
<h2>Best Practices</h2>
<h2 class="subheader">We have some best practice recommendations to help you optimize your experience with the Foundation CSS package.</h2>
<h3>Making Changes to Foundation Default Stylings</h3>
<div class="row">
<div class="large-7 columns">
<img class="round-margin" src="{{assets}}/img/images/using-css.png">
</div>
<div class="large-5 columns">
<p>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.</p>
<p class="subheader"><strong>Note:</strong> be sure to link the ```app.css``` stylesheet into the ```<head>``` of your file.</p>
</div>
</div>
</div>
</div>
<hr>
<h2> HTML Page Markup</h2>
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.
<h4>HTML</h4>
{{#markdown}}
```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>
```
{{/markdown}}