zurb/foundation
Foundation is a responsive front-end framework for building sites and apps on any device. Includes a customizable grid, Sass mixins, JavaScript plugins, and accessibility support, with docs and releases available to help you go from prototype to production.
title: Prototyping Utilities description: Quickly prototype layouts and UI with Foundation's Prototyping Utilities. These optional classes and mixins are great for quickly turning sketches and mockups into coded prototypes. video: Xhc_KUJMEuk sass:
Prototyping allows us to see problems more clearly—and often earlier—in the development process. Designs in sketches or wireframes only get us so far in understanding the behavior, feasibility, and cost (time or resources) of implementation. Prototyping processes foster collaboration where designers and developers work closely together find better solutions.
Sometimes prototype code is meant to be thrown away, and that's ok. While in early stage development it's extremely valuable to get ideas and interactions up and shared with stakeholders for scrutiny. This is how ideas get fleshed out and improved. It's not code we're delivering, it's a solution to a problem. Get the idea out, get feedback, iterate, repeat. Then when all parties are satisfied the right approach is being taken, go back to clean it up and refactor.
Foundation's Prototyping Utilities help you build coded prototypes from scratch ultra-fast. This allows you to get to right answer faster through feedback and experimentation. From positioning to visual styles, there are a range of utilities to choose from. Every Utility has a mixin, so you can use your own custom classes or swap classes for mixins in production for cleaner markup.
Not all projects require Prototyping Utilities and adding utility classes like these increase your CSS file size especially if you're not using all of them. For these reasons Prototype mode is disabled by default.
Using the Sass version of Foundation, you can enable prototype mode in two ways:
If you use the foundation-everything() mixin in your main Sass file, just pass in $prototype: true to enable the prototype mode.
[@include](https://github.com/include) foundation-everything($prototype: true);
If you included each component manually (like our starter projects do), open up your app.scss file and simply comment in:
// [@include](https://github.com/include) foundation-prototype-classes;
So it will look like:
[@include](https://github.com/include) foundation-prototype-classes;
You can instead import only the specific utility classes that you need. To make it easy, the full list is included below:
[@include](https://github.com/include) foundation-prototype-typescale;
[@include](https://github.com/include) foundation-prototype-text-utilities;
[@include](https://github.com/include) foundation-prototype-text-transformation;
[@include](https://github.com/include) foundation-prototype-text-decoration;
[@include](https://github.com/include) foundation-prototype-font-styling;
[@include](https://github.com/include) foundation-prototype-list-style-type;
[@include](https://github.com/include) foundation-prototype-rounded;
[@include](https://github.com/include) foundation-prototype-bordered;
[@include](https://github.com/include) foundation-prototype-shadow;
[@include](https://github.com/include) foundation-prototype-arrow;
[@include](https://github.com/include) foundation-prototype-separator;
[@include](https://github.com/include) foundation-prototype-overflow;
[@include](https://github.com/include) foundation-prototype-display;
[@include](https://github.com/include) foundation-prototype-position;
[@include](https://github.com/include) foundation-prototype-border-box;
[@include](https://github.com/include) foundation-prototype-border-none;
[@include](https://github.com/include) foundation-prototype-sizing;
[@include](https://github.com/include) foundation-prototype-spacing;
Looking for more customization? Click here for the Sass Reference
These prototype classes also have an optional mobile first responsive classes so that setting a class will apply to the small breakpoint and large unless overridden by a class for a larger breakpoint.
You can easily enable these classes by setting $global-prototype-breakpoints to true.
<p class="medium-text-uppercase">This text will be uppercase for medium and up.</p>
<p class="large-text-lowercase">This text will be lowercase for large breakpoint.</p>
You can also customise things by choosing to add responsive breakpoints only for specific prototype helpers that you would need as responsive classes.
For example, text transformation classes have a breakpoint variable $prototype-transformation-breakpoints which is set to $global-prototype-breakpoints which is set to false by default. For enabling responsive breakpoints for text transformation classes, simply set:
$prototype-transformation-breakpoints: true;
These .radius, .rounded, .bordered & .shadow classes can be used independently or together to style the component by rounding its corners, giving light borders, and creating shadow to it respectively. Mostly used in buttons, cards, tables, images and many more.
<button type="button" class="button radius bordered shadow primary">Primary</button>
<button type="button" class="button rounded bordered shadow secondary">Secondary</button>
<button type="button" class="button radius bordered shadow success">Success</button>
<button type="button" class="button rounded bordered shadow alert">Alert</button>
<button type="button" class="button radius bordered shadow warning">Warning</button>
Add the .rounded class to .switch to make it rounded.
<div class="switch rounded">
<input class="switch-input" id="exampleSwitch" type="checkbox" name="exampleSwitch">
<label class="switch-paddle" for="exampleSwitch">
<span class="show-for-sr">Download Kittens</span>
</label>
</div>
<div class="radius bordered shadow card">
<img src="https://placehold.it/500x250">
<div class="card-divider">
Styled Card
</div>
<div class="card-section">
<h4>This is a card.</h4>
<p>It has an easy to override visual style, and is appropriately subdued.</p>
</div>
</div>
<table class="radius bordered shadow">
<!-- My Table goes here -->
</table>
<img src="https://placehold.it/150x150" class="radius">
Mostly used as dropdown arrows for navigation.
<div class="arrow-down"></div>
<div class="arrow-up"></div>
<div class="arrow-right"></div>
<div class="arrow-left"></div>
This creates a tiny separator below the heading of an element and is usually used within the heading of a section.
<h3 class="separator-left">Lorem</h3>
<h3 class="separator-center">Ipsum Dolor</h3>
<h3 class="separator-right">Tempor</h3>
You can use font styling to style your text. You can change the font styling by adding font-normal, font-bold, font-italic to an element. You can also larger the text of an element with font-wide.
<p class="font-wide">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<p class="font-normal">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<p class="font-bold">Perspiciatis tempore cumque, magni aspernatur, quidem. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse</p>
<p class="font-italic">Lorem minus, placeat, cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.iure voluptas aliquam tempora neque?</p>
<ul class="no-bullet"></ul>
<ul class="list-disc"></ul>
<ul class="list-circle"></ul>
<ul class="list-square"></ul>
<ol class="no-bullet"></ol>
<ol class="list-decimal"></ol>
<ol class="list-lower-alpha"></ol>
<ol class="list-lower-latin"></ol>
<ol class="list-lower-roman"></ol>
<ol class="list-upper-alpha"></ol>
<ol class="list-upper-latin"></ol>
<ol class="list-upper-roman"></ol>
You can include an image with visually hidden helper text for the sake of accessibility and improving SEO. The .text-hide class will visually hide an element’s text within the context of an image.
<a href="#" class="text-hide">
<img src="https://placehold.it/100x30" alt="zurb logo">
Zurb <!-- Logo Text -->
</a>
Text transformation lets you control the capitalization of text. You can change the text transformation by adding .text-uppercase, text-lowercase, text-capitalize to an element.
<p class="text-uppercase"><!-- Text here --></p>
<p class="text-lowercase"><!-- Text here --></p>
<p class="text-capitalize"><!-- Text here --></p>
Text Decoration can be used to underline, overline, or line-through a text. You can change the text decoration by adding .text-underline, .text-overline, or .text-line-through to an element.
<p class="text-underline">Lorem ipsum dolor sit amet, consectetur adipisicing elit. </p>
<p class="text-overline">Perspiciatis tempore cumque, magni aspernatur, quidem</p>
<p class="text-line-through">Lorem minus, placeat, iure voluptas aliquam tempora neque?</p>
The .text-truncate class will truncate your text and display an elipsis. This class works for a single line of text.
<p class="text-truncate">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam voluptatem similique officiis recusandae esse cum in totam quisquam perspiciatis quod! Magnam culpa vitae, tempore eos explicabo cupiditate. Deserunt, quisquam, quos!</p>
If you would like to prevent the text wrapping into the next line you can utilize .text-nowrap. Please note that the text will continue to be in same line unless the <br> tag is used.
<p class="text-nowrap">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam voluptatem similique officiis recusandae esse cum in totam quisquam perspiciatis quod! Magnam culpa vitae, tempore eos explicabo cupiditate. Deserunt, quisquam, quos!</p>
To force text to wrap to the next line, you can use .text-wrap.
<p class="text-wrap">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam voluptatem similique officiis recusandae esse cum in totam quisquam perspiciatis quod! Magnam culpa vitae, tempore eos explicabo cupiditate. Deserunt, quisquam, quos!</p>
Generate spacing around elements with these easy to use margin classes.
<div class="margin-0"></div>
<div class="margin-1"></div>
<div class="margin-2"></div>
<div class="margin-3"></div>
<div class="margin-top-0"></div>
<div class="margin-top-1"></div>
<div class="margin-top-2"></div>
<div class="margin-top-3"></div>
<div class="margin-bottom-0"></div>
<div class="margin-bottom-1"></div>
<div class="margin-bottom-2"></div>
<div class="margin-bottom-3"></div>
<div class="margin-left-0"></div>
<div class="margin-left-1"></div>
<div class="margin-left-2"></div>
<div class="margin-left-3"></div>
<div class="margin-right-0"></div>
<div class="margin-right-1"></div>
<div class="margin-right-2"></div>
<div class="margin-right-3"></div>
<div class="margin-horizontal-0"></div>
<div class="margin-horizontal-1"></div>
<div class="margin-horizontal-2"></div>
<div class="margin-horizontal-3"></div>
<div class="margin-vertical-0"></div>
<div class="margin-vertical-1"></div>
<div class="margin-vertical-2"></div>
<div class="margin-vertical-3"></div>
.foo {
[@include](https://github.com/include) margin(1, 0, 2, null);
}
This above code will generate the below output
.foo {
margin-top: 1rem !important;
margin-right: 0 !important;
margin-bottom: 2rem !important;
}
Note: The margin-left property wasn't printed as this mixin also accept null as a value to reduce CSS output. See Sass Reference here
Generate spaces around the content with these easy to use padding classes.
<div class="padding-0"></div>
<div class="padding-1"></div>
<div class="padding-2"></div>
<div class="padding-3"></div>
<div class="padding-top-0"></div>
<div class="padding-top-1"></div>
<div class="padding-top-2"></div>
<div class="padding-top-3"></div>
<div class="padding-bottom-0"></div>
<div class="padding-bottom-1"></div>
<div class="padding-bottom-2"></div>
<div class="padding-bottom-3"></div>
<div class="padding-left-0"></div>
<div class="padding-left-1"></div>
<div class="padding-left-2"></div>
<div class="padding-left-3"></div>
<div class="padding-right-0"></div>
<div class="padding-right-1"></div>
<div class="padding-right-2"></div>
<div class="padding-right-3"></div>
<div class="padding-horizontal-0"></div>
<div class="padding-horizontal-1"></div>
<div class="padding-horizontal-2"></div>
<div class="padding-horizontal-3"></div>
<div class="padding-vertical-0"></div>
<div class="padding-vertical-1"></div>
<div class="padding-vertical-2"></div>
<div class="padding-vertical-3"></div>
.bar {
[@include](https://github.com/include) padding(1, 0, 2, null);
}
This above code will generate the below output
.bar {
padding-top: 1rem !important;
padding-right: 0 !important;
padding-bottom: 2rem !important;
}
Note: The padding-left property wasn't printed as this mixin also accept null as a value to reduce CSS output. See Sass Reference here
These width and height classes help you to easily make an element as wide or as tall as needed relative to its parent. By default it supports 25%, 50%, 75% and 100%. You can add more sizes though, through Sass map variable.
<div class="width-25"></div>
<div class="width-50"></div>
<div class="width-75"></div>
<div class="width-100"></div>
<div class="max-width-100"></div>
<div class="height-25"></div>
<div class="height-50"></div>
<div class="height-75"></div>
<div class="height-100"></div>
<div class="max-height-100"></div>
Border box lets you only add the content, padding and border, but not the margin within the width and height CSS properties.
<div class="border-box"></div>
Border none lets you quickly resets border to none for any element.
<div class="callout primary border-none">
Hi! I am a callout with no Borders
</div>
Display classes allow you to change the display property of any element.
<div class="display-inline"></div>
<div class="display-inline-block"></div>
<div class="display-block"></div>
<div class="display-table"></div>
<div class="display-table-cell"></div>
These cover some of the most used display types. There are many other display values as specified by MDN [here](https://developer.mozilla.org/en-US/docs/Web/CSS/displ...
How can I help you explore Laravel packages today?