5
<title>Example: Using Grid Units</title>
6
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Maven+Pro:400,700">
7
<link rel="stylesheet" href="../../build/cssgrids/grids-min.css">
8
<link rel="stylesheet" href="../assets/css/main.css">
9
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
10
<script src="../../build/yui/yui-min.js"></script>
15
<h1>Example: Using Grid Units</h1>
20
<div class="yui3-u-3-4">
22
<div class="content"><div class="intro">
23
<p>Creating a layout using grids requires a <code>yui3-g</code> container
24
and any number of <code>yui3-u-*</code> units.
25
To create a layout that splits the available width into 2 equal parts,
26
use two <code>yui3-u-1-2</code> units. The last two numbers of the class name, "1-2", represent
31
<div class="example newwindow">
32
<a href="cssgrids-units-example.html" target="_blank" class="button">
33
View Example in New Window
38
<p>The only child elements (e.g. direct descendants) of a <code>yui3-g</code> should be <code>yui-3-u-*</code> elements. Any elements within a <code>yui3-g</code> need to be wrapped in a <code>yui3-u-*</code> of some kind, otherwise you may experience side-effects due to the layout system being used.</p>
39
<h3>Basic Markup Structure</h3>
41
<pre class="code prettyprint"><div class="yui3-g">
42
<div class="yui3-u-1-2"></div>
43
<div class="yui3-u-1-2"></div>
44
</div></pre>
47
<h3>Provide a Content Container</h3>
48
<p>Styling should be applied to a container within the unit, rather than the unit itself. This allows you to set borders, padding, margins (gutters), etc. without worrying about breaking the layout. For this demo we will give the content a class of <code>content</code>, but can be called whatever you like.</p>
50
<pre class="code prettyprint"><div class="yui3-g">
51
<div class="yui3-u-1-2">
52
<div class="content">
56
<div class="yui3-u-1-2">
57
<div class="content">
61
</div></pre>
64
<h3>Adding a Gutter</h3>
65
<p>All units align edge to edge, with zero space in between. You can add space ("gutter"), by simply adding a margin to your content. This is where additional content styling, such as borders, padding, colors, etc. can be applied as well.</p>
67
<pre class="code prettyprint"><style>
69
border: 2px solid #000;
70
margin-right:10px; /* "column" gutters */
73
</style></pre>
76
<h3>Available Units</h3>
87
<td><code>.yui3-u</code></td>
88
<td>shrinks to fit content (unless given an explicit size)</td>
91
<td><code>.yui3-u-1</code></td>
92
<td>fills entire width of container</td>
95
<td><code>.yui3-u-1-2</code></td>
96
<td>fills 1/2 the container</td>
99
<td><code>.yui3-u-1-3</code></td>
100
<td>fills 1/3 the container</td>
103
<td><code>.yui3-u-2-3</code></td>
104
<td>fills 2/3 the container</td>
107
<td><code>.yui3-u-1-4</code></td>
108
<td>fills 1/4 the container</td>
111
<td><code>.yui3-u-3-4</code></td>
112
<td>fills 3/4 the container</td>
115
<td><code>.yui3-u-1-5</code></td>
116
<td>fills 1/5 the container</td>
119
<td><code>.yui3-u-2-5</code></td>
120
<td>fills 2/5 the container</td>
123
<td><code>.yui3-u-3-5</code></td>
124
<td>fills 3/5 the container</td>
127
<td><code>.yui3-u-4-5</code></td>
128
<td>fills 4/5 the container</td>
131
<td><code>.yui3-u-1-6</code></td>
132
<td>fills 1/6 the container</td>
135
<td><code>.yui3-u-5-6</code></td>
136
<td>fills 5/6 the container</td>
144
<div class="yui3-u-1-4">
145
<div class="sidebar">
149
<div class="sidebox">
151
<h2 class="no-toc">Examples</h2>
155
<ul class="examples">
158
<li data-description="Each unit has a className that provides its percentage width.">
159
<a href="cssgrids-units.html">Using Grid Units</a>
164
<li data-description="This is a template for creating fixed-width layouts.">
165
<a href="cssgrids-fixed.html">Fixed Page Template</a>
170
<li data-description="This is a template for creating fluid layouts.">
171
<a href="cssgrids-fluid.html">Fluid Page Template</a>
176
<li data-description="Basic CSS properties are leveraged to horizontally and vertically align units.">
177
<a href="cssgrids-align.html">Aligning Grid Units</a>
201
<div class="sidebox">
203
<h2 class="no-toc">Examples That Use This Component</h2>
207
<ul class="examples">
218
<li data-description="Creating left navigation using the MenuNav Node Plugin.">
219
<a href="../node-menunav/menunav-leftnav.html">Basic Left Nav</a>
224
<li data-description="Creating top navigation using the MenuNav Node Plugin">
225
<a href="../node-menunav/node-menunav-2.html">Basic Top Nav</a>
230
<li data-description="Creating menu button navigation using the MenuNav Node Plugin">
231
<a href="../node-menunav/node-menunav-3.html">Menu Button Top Nav</a>
236
<li data-description="Creating split button navigation using the MenuNav Node Plugin">
237
<a href="../node-menunav/node-menunav-4.html">Split Button Top Nav</a>
242
<li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin">
243
<a href="../node-menunav/node-menunav-5.html">Left Nav with Submenus with Shadows</a>
248
<li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin">
249
<a href="../node-menunav/node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a>
254
<li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr">
255
<a href="../node-menunav/node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a>
268
<script src="../assets/vendor/prettify/prettify-min.js"></script>
269
<script>prettyPrint();</script>