5
<title>Example: Fluid Page Template</title>
6
<link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
7
<link rel="stylesheet" href="../assets/css/main.css">
8
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
<script src="../../build/yui/yui-min.js"></script>
14
<h1>Example: Fluid Page Template</h1>
19
<div id="main" class="yui3-u">
20
<div class="content"><div class="intro">
21
<p>Creating a fluid layout with YUI Grids requires some custom sizing to achieve the fluid effect.</p>
24
<div class="example newwindow">
25
<a href="cssgrids-fluid-example.html" target="_blank" class="button">
26
View Example in New Window
30
<p>A fluid grid starts with the basic markup structure of a <code>yui3-g</code> grid and some <code>yui3-u</code> units.
31
<h3>Basic Markup Structure</h3>
33
<pre class="code prettyprint"><div class="yui3-g">
34
<div class="yui3-u"></div>
35
<div class="yui3-u"></div>
36
<div class="yui3-u"></div>
37
</div></pre>
40
<p>Creating a fluid layout requires manually fixing the sizes and using a combination of <code>padding</code> and negative margins, so we can stick with the basic <code>yui3-u</code> unit. Rather than extending the <code>yui3-u</code> unit directly, we will add some unique <code>ID</code>s to our "columns" to deliver the sizing. The actual <code>ID</code>s are entirely up to you, but by convention should describe your content rather than its presentation or layout. We will apply an ID to the <code>yui3-g</code> container as well, as this is where the padding will be added to create space for the side columns.</p>
42
<pre class="code prettyprint"><div class="yui3-g" id="layout">
43
<div class="yui3-u" id="nav"></div>
44
<div class="yui3-u" id="main"></div>
45
<div class="yui3-u" id="extra"></div>
46
</div></pre>
49
<p>We also need to add our custom CSS for the fluid layout. The container for the units is padded to match the widths of each side column, each side column gets a fixed width and a negative margin that matches the fixed width. The center column is set to 100% width, filling the container minus its padding.</p>
51
<pre class="code prettyprint"><style>
53
padding-left:300px; /* "left col" width */
54
padding-right:150px; /* "right col" width */
58
margin-left:-300px; /* "left col" width */
64
margin-right:-150px; /* "right col" width */
71
</style></pre>
76
<div id="sidebar" class="yui3-u">
82
<h2 class="no-toc">Examples</h2>
89
<li data-description="Each unit has a className that provides its percentage width.">
90
<a href="cssgrids-units.html">Using Grid Units</a>
95
<li data-description="This is a template for creating fixed-width layouts.">
96
<a href="cssgrids-fixed.html">Fixed Page Template</a>
101
<li data-description="This is a template for creating fluid layouts.">
102
<a href="cssgrids-fluid.html">Fluid Page Template</a>
107
<li data-description="Basic CSS properties are leveraged to horizontally and vertically align units.">
108
<a href="cssgrids-align.html">Aligning Grid Units</a>
132
<div class="sidebox">
134
<h2 class="no-toc">Examples That Use This Component</h2>
138
<ul class="examples">
149
<li data-description="Creating left navigation using the MenuNav Node Plugin.">
150
<a href="../node-menunav/menunav-leftnav.html">Basic Left Nav</a>
155
<li data-description="Creating top navigation using the MenuNav Node Plugin">
156
<a href="../node-menunav/node-menunav-2.html">Basic Top Nav</a>
161
<li data-description="Creating menu button navigation using the MenuNav Node Plugin">
162
<a href="../node-menunav/node-menunav-3.html">Menu Button Top Nav</a>
167
<li data-description="Creating split button navigation using the MenuNav Node Plugin">
168
<a href="../node-menunav/node-menunav-4.html">Split Button Top Nav</a>
173
<li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin">
174
<a href="../node-menunav/node-menunav-5.html">Left Nav with Submenus with Shadows</a>
179
<li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin">
180
<a href="../node-menunav/node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a>
185
<li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr">
186
<a href="../node-menunav/node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a>
198
<script src="../assets/vendor/prettify/prettify-min.js"></script>
199
<script>prettyPrint();</script>