|
1 <!DOCTYPE html> |
|
2 <html lang="en"> |
|
3 <head> |
|
4 <meta charset="utf-8"> |
|
5 <title>Example: Fixed 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: Fixed 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>This example demonstrates how to create a fixed width page using YUI Grids.</p> |
|
30 </div> |
|
31 |
|
32 <div class="example newwindow"> |
|
33 <a href="cssgrids-fixed-example.html" target="_blank" class="button"> |
|
34 View Example in New Window |
|
35 </a> |
|
36 </div> |
|
37 |
|
38 <p>A fixed grid starts with the basic markup structure of a <code>yui3-g</code> grid and some <code>yui3-u</code> units. For this example, we will create a 970px page and use <code>yui-u-1-5</code> to make the left column 194px, and <code>yui-2-5</code> to split the other 2 into 388px columns each.</p> |
|
39 <h3>Basic Markup Structure</h3> |
|
40 |
|
41 <pre class="code prettyprint"><div class="yui3-g"> |
|
42 <div class="yui3-u-1-5"></div> |
|
43 <div class="yui3-u-2-5"></div> |
|
44 <div class="yui3-u-2-5"></div> |
|
45 </div></pre> |
|
46 |
|
47 |
|
48 <h3>Adding Content</h3> |
|
49 <p>As with all <code>yui3-u-*</code> units, to avoid layout complications, all column styling should be applied to a container within the unit rather than on the unit itself. |
|
50 For this demo we will add a container with the class <code>content</code> to contain our content, but you can feel free to call this whatever you like.</p> |
|
51 |
|
52 <pre class="code prettyprint"><div class="yui3-g"> |
|
53 <div class="yui3-u-1-5"> |
|
54 <div class="content"> |
|
55 |
|
56 </div> |
|
57 </div> |
|
58 <div class="yui3-u-2-5"> |
|
59 <div class="content"> |
|
60 |
|
61 </div> |
|
62 </div> |
|
63 <div class="yui3-u-2-5"> |
|
64 <div class="content"> |
|
65 |
|
66 </div> |
|
67 </div> |
|
68 </div></pre> |
|
69 |
|
70 |
|
71 <h3>Fixing the Page Width</h3> |
|
72 <p>To fix the size of the page, simply apply a width to the outermost page container. For this example, we will apply the <code>ID</code> <code>doc</code> to the <code>body</code> element and apply the width there. To center the layout, set the margin to <code>auto</code>.</p> |
|
73 |
|
74 <pre class="code prettyprint"><style> |
|
75 #doc { |
|
76 margin:auto; /* center in viewport */ |
|
77 width: 970px; /* fix page width */ |
|
78 } |
|
79 </style></pre> |
|
80 |
|
81 |
|
82 <h3>Adding Gutters and other Column Styling</h3> |
|
83 <p>The <code>content</code> container is where margins between columns ("gutters"), padding, borders, and other content styling can be applied.</p> |
|
84 |
|
85 <pre class="code prettyprint"><style> |
|
86 .yui3-g .content { |
|
87 border: 2px solid #000; |
|
88 margin-right:10px; /* "column" gutters */ |
|
89 padding: 1em; |
|
90 } |
|
91 </style></pre> |
|
92 |
|
93 </div> |
|
94 </div> |
|
95 </div> |
|
96 |
|
97 <div class="yui3-u-1-4"> |
|
98 <div class="sidebar"> |
|
99 |
|
100 |
|
101 |
|
102 <div class="sidebox"> |
|
103 <div class="hd"> |
|
104 <h2 class="no-toc">Examples</h2> |
|
105 </div> |
|
106 |
|
107 <div class="bd"> |
|
108 <ul class="examples"> |
|
109 |
|
110 |
|
111 <li data-description="Each unit has a className that provides its percentage width."> |
|
112 <a href="cssgrids-units.html">Using Grid Units</a> |
|
113 </li> |
|
114 |
|
115 |
|
116 |
|
117 <li data-description="This is a template for creating fixed-width layouts."> |
|
118 <a href="cssgrids-fixed.html">Fixed Page Template</a> |
|
119 </li> |
|
120 |
|
121 |
|
122 |
|
123 <li data-description="This is a template for creating fluid layouts."> |
|
124 <a href="cssgrids-fluid.html">Fluid Page Template</a> |
|
125 </li> |
|
126 |
|
127 |
|
128 |
|
129 <li data-description="Basic CSS properties are leveraged to horizontally and vertically align units."> |
|
130 <a href="cssgrids-align.html">Aligning Grid Units</a> |
|
131 </li> |
|
132 |
|
133 |
|
134 |
|
135 <li data-description="A responsive layout that looks like a newspaper"> |
|
136 <a href="cssgrids-magazine.html">Responsive Newspaper Layout</a> |
|
137 </li> |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 </ul> |
|
155 </div> |
|
156 </div> |
|
157 |
|
158 |
|
159 |
|
160 <div class="sidebox"> |
|
161 <div class="hd"> |
|
162 <h2 class="no-toc">Examples That Use This Component</h2> |
|
163 </div> |
|
164 |
|
165 <div class="bd"> |
|
166 <ul class="examples"> |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 <li data-description="Creating left navigation using the MenuNav Node Plugin."> |
|
180 <a href="../node-menunav/menunav-leftnav.html">Basic Left Nav</a> |
|
181 </li> |
|
182 |
|
183 |
|
184 |
|
185 <li data-description="Creating top navigation using the MenuNav Node Plugin"> |
|
186 <a href="../node-menunav/node-menunav-2.html">Basic Top Nav</a> |
|
187 </li> |
|
188 |
|
189 |
|
190 |
|
191 <li data-description="Creating menu button navigation using the MenuNav Node Plugin"> |
|
192 <a href="../node-menunav/node-menunav-3.html">Menu Button Top Nav</a> |
|
193 </li> |
|
194 |
|
195 |
|
196 |
|
197 <li data-description="Creating split button navigation using the MenuNav Node Plugin"> |
|
198 <a href="../node-menunav/node-menunav-4.html">Split Button Top Nav</a> |
|
199 </li> |
|
200 |
|
201 |
|
202 |
|
203 <li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin"> |
|
204 <a href="../node-menunav/node-menunav-5.html">Left Nav with Submenus with Shadows</a> |
|
205 </li> |
|
206 |
|
207 |
|
208 |
|
209 <li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin"> |
|
210 <a href="../node-menunav/node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a> |
|
211 </li> |
|
212 |
|
213 |
|
214 |
|
215 <li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr"> |
|
216 <a href="../node-menunav/node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a> |
|
217 </li> |
|
218 |
|
219 |
|
220 </ul> |
|
221 </div> |
|
222 </div> |
|
223 |
|
224 </div> |
|
225 </div> |
|
226 </div> |
|
227 </div> |
|
228 |
|
229 <script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
230 <script>prettyPrint();</script> |
|
231 |
|
232 <script> |
|
233 YUI.Env.Tests = { |
|
234 examples: [], |
|
235 project: '../assets', |
|
236 assets: '../assets/cssgrids', |
|
237 name: 'cssgrids-fixed', |
|
238 title: 'Fixed Page Template', |
|
239 newWindow: 'true', |
|
240 auto: false |
|
241 }; |
|
242 YUI.Env.Tests.examples.push('cssgrids-units'); |
|
243 YUI.Env.Tests.examples.push('cssgrids-fixed'); |
|
244 YUI.Env.Tests.examples.push('cssgrids-fluid'); |
|
245 YUI.Env.Tests.examples.push('cssgrids-align'); |
|
246 YUI.Env.Tests.examples.push('cssgrids-magazine'); |
|
247 YUI.Env.Tests.examples.push('menunav-leftnav'); |
|
248 YUI.Env.Tests.examples.push('node-menunav-2'); |
|
249 YUI.Env.Tests.examples.push('node-menunav-3'); |
|
250 YUI.Env.Tests.examples.push('node-menunav-4'); |
|
251 YUI.Env.Tests.examples.push('node-menunav-5'); |
|
252 YUI.Env.Tests.examples.push('node-menunav-6'); |
|
253 YUI.Env.Tests.examples.push('node-menunav-7'); |
|
254 |
|
255 </script> |
|
256 <script src="../assets/yui/test-runner.js"></script> |
|
257 |
|
258 |
|
259 |
|
260 </body> |
|
261 </html> |