|
1 <!DOCTYPE html> |
|
2 <html lang="en"> |
|
3 <head> |
|
4 <meta charset="utf-8"> |
|
5 <title>Example: Fluid Page Template</title> |
|
6 <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic"> |
|
7 <link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css"> |
|
8 <link rel="stylesheet" href="../assets/css/main.css"> |
|
9 <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> |
|
10 <link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> |
|
11 <script src="../../build/yui/yui-min.js"></script> |
|
12 |
|
13 </head> |
|
14 <body> |
|
15 <!-- |
|
16 <a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a> |
|
17 --> |
|
18 <div id="doc"> |
|
19 <div id="hd"> |
|
20 <h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1> |
|
21 </div> |
|
22 |
|
23 |
|
24 <h1>Example: Fluid Page Template</h1> |
|
25 <div class="yui3-g"> |
|
26 <div class="yui3-u-3-4"> |
|
27 <div id="main"> |
|
28 <div class="content"><div class="intro"> |
|
29 <p>Creating a fluid layout with YUI Grids requires some custom sizing to achieve the fluid effect.</p> |
|
30 </div> |
|
31 |
|
32 <div class="example newwindow"> |
|
33 <a href="cssgrids-fluid-example.html" target="_blank" class="button"> |
|
34 View Example in New Window |
|
35 </a> |
|
36 </div> |
|
37 |
|
38 <p>A fluid grid starts with the basic markup structure of a <code>yui3-g</code> grid and some <code>yui3-u</code> units. |
|
39 <h3>Basic Markup Structure</h3> |
|
40 |
|
41 <pre class="code prettyprint"><div class="yui3-g"> |
|
42 <div class="yui3-u"></div> |
|
43 <div class="yui3-u"></div> |
|
44 <div class="yui3-u"></div> |
|
45 </div></pre> |
|
46 |
|
47 |
|
48 <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> |
|
49 |
|
50 <pre class="code prettyprint"><div class="yui3-g" id="layout"> |
|
51 <div class="yui3-u" id="nav"></div> |
|
52 <div class="yui3-u" id="main"></div> |
|
53 <div class="yui3-u" id="extra"></div> |
|
54 </div></pre> |
|
55 |
|
56 |
|
57 <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> |
|
58 |
|
59 <pre class="code prettyprint"><style> |
|
60 #layout { |
|
61 padding-left:300px; /* "left col" width */ |
|
62 padding-right:150px; /* "right col" width */ |
|
63 } |
|
64 |
|
65 #nav { |
|
66 margin-left:-300px; /* "left col" width */ |
|
67 width:300px; |
|
68 } |
|
69 |
|
70 #extra { |
|
71 width:150px; |
|
72 margin-right:-150px; /* "right col" width */ |
|
73 } |
|
74 |
|
75 #main { |
|
76 width:100%; |
|
77 } |
|
78 |
|
79 </style></pre> |
|
80 |
|
81 </div> |
|
82 </div> |
|
83 </div> |
|
84 |
|
85 <div class="yui3-u-1-4"> |
|
86 <div class="sidebar"> |
|
87 |
|
88 |
|
89 |
|
90 <div class="sidebox"> |
|
91 <div class="hd"> |
|
92 <h2 class="no-toc">Examples</h2> |
|
93 </div> |
|
94 |
|
95 <div class="bd"> |
|
96 <ul class="examples"> |
|
97 |
|
98 |
|
99 <li data-description="Each unit has a className that provides its percentage width."> |
|
100 <a href="cssgrids-units.html">Using Grid Units</a> |
|
101 </li> |
|
102 |
|
103 |
|
104 |
|
105 <li data-description="This is a template for creating fixed-width layouts."> |
|
106 <a href="cssgrids-fixed.html">Fixed Page Template</a> |
|
107 </li> |
|
108 |
|
109 |
|
110 |
|
111 <li data-description="This is a template for creating fluid layouts."> |
|
112 <a href="cssgrids-fluid.html">Fluid Page Template</a> |
|
113 </li> |
|
114 |
|
115 |
|
116 |
|
117 <li data-description="Basic CSS properties are leveraged to horizontally and vertically align units."> |
|
118 <a href="cssgrids-align.html">Aligning Grid Units</a> |
|
119 </li> |
|
120 |
|
121 |
|
122 |
|
123 <li data-description="A responsive layout that looks like a newspaper"> |
|
124 <a href="cssgrids-magazine.html">Responsive Newspaper Layout</a> |
|
125 </li> |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 </ul> |
|
143 </div> |
|
144 </div> |
|
145 |
|
146 |
|
147 |
|
148 <div class="sidebox"> |
|
149 <div class="hd"> |
|
150 <h2 class="no-toc">Examples That Use This Component</h2> |
|
151 </div> |
|
152 |
|
153 <div class="bd"> |
|
154 <ul class="examples"> |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 <li data-description="Creating left navigation using the MenuNav Node Plugin."> |
|
168 <a href="../node-menunav/menunav-leftnav.html">Basic Left Nav</a> |
|
169 </li> |
|
170 |
|
171 |
|
172 |
|
173 <li data-description="Creating top navigation using the MenuNav Node Plugin"> |
|
174 <a href="../node-menunav/node-menunav-2.html">Basic Top Nav</a> |
|
175 </li> |
|
176 |
|
177 |
|
178 |
|
179 <li data-description="Creating menu button navigation using the MenuNav Node Plugin"> |
|
180 <a href="../node-menunav/node-menunav-3.html">Menu Button Top Nav</a> |
|
181 </li> |
|
182 |
|
183 |
|
184 |
|
185 <li data-description="Creating split button navigation using the MenuNav Node Plugin"> |
|
186 <a href="../node-menunav/node-menunav-4.html">Split Button Top Nav</a> |
|
187 </li> |
|
188 |
|
189 |
|
190 |
|
191 <li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin"> |
|
192 <a href="../node-menunav/node-menunav-5.html">Left Nav with Submenus with Shadows</a> |
|
193 </li> |
|
194 |
|
195 |
|
196 |
|
197 <li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin"> |
|
198 <a href="../node-menunav/node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a> |
|
199 </li> |
|
200 |
|
201 |
|
202 |
|
203 <li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr"> |
|
204 <a href="../node-menunav/node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a> |
|
205 </li> |
|
206 |
|
207 |
|
208 </ul> |
|
209 </div> |
|
210 </div> |
|
211 |
|
212 </div> |
|
213 </div> |
|
214 </div> |
|
215 </div> |
|
216 |
|
217 <script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
218 <script>prettyPrint();</script> |
|
219 |
|
220 <script> |
|
221 YUI.Env.Tests = { |
|
222 examples: [], |
|
223 project: '../assets', |
|
224 assets: '../assets/cssgrids', |
|
225 name: 'cssgrids-fluid', |
|
226 title: 'Fluid Page Template', |
|
227 newWindow: 'true', |
|
228 auto: false |
|
229 }; |
|
230 YUI.Env.Tests.examples.push('cssgrids-units'); |
|
231 YUI.Env.Tests.examples.push('cssgrids-fixed'); |
|
232 YUI.Env.Tests.examples.push('cssgrids-fluid'); |
|
233 YUI.Env.Tests.examples.push('cssgrids-align'); |
|
234 YUI.Env.Tests.examples.push('cssgrids-magazine'); |
|
235 YUI.Env.Tests.examples.push('menunav-leftnav'); |
|
236 YUI.Env.Tests.examples.push('node-menunav-2'); |
|
237 YUI.Env.Tests.examples.push('node-menunav-3'); |
|
238 YUI.Env.Tests.examples.push('node-menunav-4'); |
|
239 YUI.Env.Tests.examples.push('node-menunav-5'); |
|
240 YUI.Env.Tests.examples.push('node-menunav-6'); |
|
241 YUI.Env.Tests.examples.push('node-menunav-7'); |
|
242 |
|
243 </script> |
|
244 <script src="../assets/yui/test-runner.js"></script> |
|
245 |
|
246 |
|
247 |
|
248 </body> |
|
249 </html> |