forked from todc/todc-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
639 lines (553 loc) · 21.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS3 Google UI Demo</title>
<meta name="description" content="Using CSS3 to create Google-style UI elements">
<link rel="stylesheet" href="reset.css" type="text/css" media="screen" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<style>
/* ------------------------------------------------------------------------------------------------------------- RESET */
html, body, div, form, p,
code, pre { margin: 0; padding: 0; border: 0; vertical-align: baseline; font-family: sans-serif; }
/* ------------------------------------------------------------------------------------------------------------- TEMPLATE */
body { font: 14px/18px sans-serif; color: #444; background: #eee; }
a { color: #980905; }
a:hover, a:focus, a:active { text-decoration: none; }
h1 { margin: 0 0 0.5em; font-size: 36px; font-weight: bold; }
h2 { margin: 0 0 0.75em; font-size: 21px; font-weight: bold; }
h3 { margin: 0 0 0.333em; font-size: 16px; font-weight: normal; }
p { margin: 0 0 1.333em; line-height: 18px; }
em { font-style: italic; }
table { border-collapse: separate; border-spacing: 0; margin: 0; vertical-align: middle; }
th { font-weight: bold; }
th, td { padding: 5px 25px 5px 5px; text-align: left; vertical-align: middle; }
pre, code { font-family: monospace, sans-serif; font-size: 1em; color:#080; }
/* ------------------------------------------------------------------------------------------------------------- TEMPLATE */
.container { position:relative; overflow:hidden; width: 700px; padding: 40px 60px; border: 1px solid #ccc; margin: 40px auto 20px; background: #fff; -webkit-box-shadow: 0 0 15px rgba(0,0,0,0.1); -moz-box-shadow: 0 0 15px rgba(0,0,0,0.1); box-shadow: 0 0 15px rgba(0,0,0,0.1); }
.container pre,
.container .prettyprint { padding: 0; border: 0; margin: 0 0 20px; font-size: 13px; background: #fff; }
.ribbon { position: absolute; top: -1px; right: -1px; opacity: 0.9; }
.ribbon:hover, .ribbon:focus, .ribbon:active { opacity: 1; }
.ribbon img { display: block; border: 0; }
.header { padding-right:80px; }
.section { margin: 40px 0 20px; }
.example { padding: 20px; border: 1px solid #ccc; margin: 10px -20px 20px; }
.footer { margin: 20px 0 50px; font-size: 11px; color: #666; text-align: center; }
.footer a { color: #666; }
</style>
<link rel="stylesheet" href="google-buttons.css" type="text/css" media="screen" />
<!-- prettyify -->
<link rel="stylesheet" href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css">
<script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script>
</head>
<body onload="prettyPrint()">
<div class="container">
<a class="ribbon" href="http://github.com/todc/css3-google-buttons" target="_blank"><img src="http://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<div class="header">
<h1>CSS3 Google Buttons</h1>
<p><b><a href="http://github.com/todc/css3-google-buttons" title="GitHub repository">CSS3 Google Buttons</a> helps you easily create Google-style UI elements.</b></p>
</div>
<div class="section">
<h2>Buttons</h2>
<p>
The "buttons" can be created by adding <code>class="button"</code> to
any appropriate <code><a></code>, <code><button></code>, or
<code><input></code> element.
</p>
<div class="example">
<pre class="code prettyprint"><code><a href="#" class="button">Post comment</a></code></pre>
<form>
<a class="button">New Comment (link)</a>
<input type="submit" value="New Comment (submit)" class="button" />
<button class="button">New Comment (button)</button>
</form>
</div>
</div>
<div class="section">
<h2>Colored Buttons</h2>
<p>
Red and blue colored buttons can be created by adding the
<code>red</code>, <code>blue</code>, or <code>green</code> class to your button.
</p>
<div class="example">
<pre class="prettyprint"><code><a href="#" class="button red">Compose Mail</a></code></pre>
<a href="#button" class="button red">Compose Mail</a>
<a href="#button" class="button blue">Search Mail</a>
<a href="#button" class="button green">Add Contact</a>
</div>
</div>
<div class="section">
<h2>Disabled Buttons</h2>
<p>
Buttons can also be disabled. The traditional style used in Google
Calendar displays the button with a white background and greyed out
text. Add the <code>disabled</code> class for this style. If you'd
rather keep the grey background but dim it, you can add the
<code>disabled2</code> class.
</p>
<div class="example">
<pre class="prettyprint"><code><a href="#" class="button disabled">Today</a>
<a href="#" class="button disabled2">Today</a></code></pre>
<a href="#button" class="button disabled">Today</a>
<a href="#button" class="button disabled2">Today</a>
</div>
</div>
<div class="section">
<h2>Smaller Buttons</h2>
<p>
Default buttons too big? Shrink the text-size of the button with the
<code>sm</code> class, or the size of the entire button with the
<code>mini</code> class.
</p>
<div class="example">
<pre class="prettyprint"><code><a href="#" class="button sm">Month</a>
<a href="#" class="button mini">Month</a></code></pre>
<a href="#button" class="button sm">Month</a>
<a href="#button" class="button mini">Month</a>
</div>
</div>
<div class="section">
<h2>Grouped buttons</h2>
<p>
Groups of buttons can be created by wrapping them in an element given
a class of <code>button-group</code>.
</p>
<div class="example">
<pre class="prettyprint"><code><div class="button-group">
<a href="#" class="button">Archive</a>
<a href="#" class="button">Spam</a>
<a href="#" class="button">Delete</a>
</div></code></pre>
<div class="button-group">
<a href="#button" class="button">Archive</a>
<a href="#button" class="button">Spam</a>
<a href="#button" class="button">Delete</a>
</div>
</div>
<div class="section">
<h2>Mixed groups</h2>
<p>
Displaying a mixture of grouped and standalone buttons, as might be
seen in a toolbar, can be done by adding another wrapping element
with the class <code>button-container</code>.
</p>
<div class="example">
<pre class="prettyprint"><code><div class="actions <b>button-container</b>">
<a href="#" class="button">Compose New</a>
<div class="button-group">
<a href="#" class="button">Archive</a>
<a href="#" class="button">Spam</a>
<a href="#" class="button">Delete</a>
</div>
<div class="button-group minor-group">
<a href="#" class="button">Move to</a>
<a href="#" class="button">Labels</a>
</div>
<a href="#" class="button">More</a>
</div></code></pre>
<div class="actions button-container">
<a href="#button" class="button">Compose New</a>
<div class="button-group">
<a href="#button" class="button">Archive</a>
<a href="#button" class="button">Spam</a>
<a href="#button" class="button">Delete</a>
</div>
<div class="button-group minor-group">
<a href="#button" class="button">Move to</a>
<a href="#button" class="button">Labels</a>
</div>
<a href="#button" class="button">More</a>
</div>
</div>
</div>
<div class="section">
<h2>Radio Button Groups</h2>
<p>
Sometimes your button group should act like a series of radio buttons,
in which selecting one button deselects the others. Add the
<code>toggle-buttons</code> class to your <code>button-group</code>
div to accomplish this. To set the currently selected button, use the
<code>checked</code> class.
</p>
<div class="example">
<pre class="prettyprint"><code><div class="button-group toggle-buttons">
<a href="#" class="button">Day</a>
<a href="#" class="button">Week</a>
<a href="#" class="button checked">Month</a>
<a href="#" class="button">4 Days</a>
<a href="#" class="button">Agenda</a>
</div></code></pre>
<div class="button-group toggle-buttons">
<a class="button">Day</a>
<a class="button">Week</a>
<a class="button checked">Month</a>
<a class="button">4 Days</a>
<a class="button">Agenda</a>
</div>
</div>
<div class="example">
<pre class="prettyprint"><code><div class="button-group toggle-buttons">
<a href="#" class="button mini">Day</a>
<a href="#" class="button mini">Week</a>
<a href="#" class="button mini checked">Month</a>
<a href="#" class="button mini">4 Days</a>
<a href="#" class="button mini">Agenda</a>
</div></code></pre>
<div class="button-group toggle-buttons">
<a class="button mini">Day</a>
<a class="button mini">Week</a>
<a class="button mini checked">Month</a>
<a class="button mini">4 Days</a>
<a class="button mini">Agenda</a>
</div>
</div>
</div>
<div class="section">
<h2>Buttons with icons only</h2>
<p>
Create a button with only an icon (no text) by adding the
<code>icon no-text</code> classes, along with one of the icon
classes below.
</p>
<div class="example">
<pre class="prettyprint"><code>
<a href="#" class="button icon return no-text"></a>
<a href="#" class="button icon reload no-text"></a>
</code></pre>
<a class="button icon return no-text"></a>
<a class="button icon reload no-text"></a>
</div>
<p>Or group them together, just like Gmail's paginator.</p>
<div class="example">
<pre class="prettyprint"><code><div class="button-group">
<a href="#" class="button icon rewind no-text"></a>
<a href="#" class="button icon play no-text"></a>
<div>
</code></pre>
<div class="button-group">
<a class="button icon rewind no-text"></a>
<a class="button icon play no-text"></a>
</div>
</div>
<p>You can even mix and match with the disabled state.</p>
<div class="example">
<pre class="prettyprint"><code><div class="button-group">
<a href="#" class="button icon rewind no-text disabled2"></a>
<a href="#" class="button icon play no-text"></a>
<div>
</code></pre>
<div class="button-group">
<a class="button icon rewind no-text disabled2"></a>
<a class="button icon play no-text"></a>
</div>
</div>
</div>
<div class="section">
<h2>Mini paginator buttons</h2>
<p>
The new back/forward buttons inside input elements on
<a href="http://google.com/flights" target="_blank">Google Flights</a>
is pretty slick. You can create those too by adding the
<code>xs pg bw</code> and <code>xs pg fw</code> classes.
</p>
<div class="example">
<pre class="prettyprint"><code><div class="button-group">
<a href="#" class="button xs pg bw"></a>
<a href="#" class="button xs pg fw"></a>
<div>
</code></pre>
<div class="button-group">
<a class="button xs pg bw"></a>
<a class="button xs pg fw"></a>
</div>
</div>
</div>
<div class="section">
<h2>Buttons with text and icon</h2>
<p>
A range of icons can be added (only for links and buttons) by adding
a class of <code>icon</code> and any one of the provided icon classes
below.
</p>
<div class="example">
<pre class="prettyprint"><code><div class="button-group">
<a href="#" class="button xs pg bw"></a>
<a href="#" class="button xs pg fw"></a>
<div>
</code></pre>
<a class="button icon search">Search</a>
</div>
<div class="example">
<table>
<thead>
<tr>
<th scope="col">Class</th>
<th scope="col">Example</th>
</tr>
</thead>
<tr>
<td scope="row"><code>.add</code></td>
<td><a href="#button" class="button icon add">Add Item</a></td>
</tr>
<tr>
<td scope="row"><code>.arrowleft</code></td>
<td><a href="#button" class="button icon arrowleft">Back</a></td>
</tr>
<tr>
<td scope="row"><code>.arrowright</code></td>
<td><a href="#button" class="button icon arrowright">Forward</a></td>
</tr>
<tr>
<td scope="row"><code>.remove</code></td>
<td><a href="#button" class="button icon remove">Remove Item</a></td>
</tr>
<tr>
<td scope="row"><code>.search</code></td>
<td><a href="#button" class="button icon search">Search</a></td>
</tr>
<tr>
<td scope="row"><code>.settings</code></td>
<td><a href="#button" class="button icon settings">Settings</a></td>
</tr>
</table>
</div>
</div>
<div class="section">
<h2>Menu Buttons</h2>
<p>
Create buttons with dropdown menus, just like Google Docs, easily.
Of course, it will require a little bit of Javascript magic, but the
CSS is all here.
</p>
<p>
Add the <code>icon menu</code> classes to your button. The Javascript
used here also requires a <code>data-menu</code> attribute to be set
on your button. The value should be the id of the <code>UL</code> for
your menu.
</p>
<div class="example" style="position:relative">
<pre class="prettyprint"><code><a class="button icon menu" data-menu="btn-menu">Menu</a>
<a class="button icon menu" data-menu="btn-menu">Another Menu</a>
<ul id="btn-menu" class="menu">
<li><a href="">Document</a></li>
<li><a href="">Presentation</a></li>
<li><a href="">Spreadsheet</a></li>
<li><a href="">Form</a></li>
</ul>
</code></pre>
<a class="button icon menu" data-menu="basic-menu">Menu</a>
<a class="button icon menu" data-menu="basic-menu">Another Menu</a>
<ul id="basic-menu" class="menu">
<li><a href="">Document</a></li>
<li><a href="">Presentation</a></li>
<li><a href="">Spreadsheet</a></li>
<li><a href="">Form</a></li>
</ul>
</div>
<p>
Menus can get pretty fancy too, with icons, dividers, disabled items, and submenus.
</p>
<div class="example" style="position:relative">
<a class="button icon menu" data-menu="fancy-menu">Fancy Menu</a>
<ul id="fancy-menu" class="menu">
<li class="has-submenu">
<a href="#">Create new</a>
<ul class="menu">
<li><a href="">Document</a></li>
<li><a href="">Presentation</a></li>
<li><a href="">Spreadsheet</a></li>
<li><a href="">Form</a></li>
</ul>
</li>
<li class="divider"></li>
<li class="has-submenu icon share">
<a href="#">Share…</a>
<ul class="menu">
<li class="has-submenu">
<a href="">Share…</a>
<ul class="menu">
<li><a href="">Share…</a></li>
<li class="divider"></li>
<li><a href="">Email collaborators…</a></li>
<li class="disabled">Email as attachment…</li>
</ul>
</li>
<li class="divider"></li>
<li><a href="">Email collaborators…</a></li>
<li class="disabled">Email as attachment…</li>
</ul>
</li>
<li class="divider"></li>
<li class="icon star"><a href="#">Add star</a></li>
<li><a href="#">Don't show in home</a></li>
<li><a href="#">Organize…</a></li>
<li class="disabled">Download…</li>
</ul>
</div>
</div>
<div class="section">
<h2>Tables</h2>
<p>
Create Google Docs styled tables by affixing the <code>gtable</code>
class to your table element.
</p>
<div class="example">
<table style="width: 500px" class="gtable">
<thead>
<tr>
<th>
<div class="checkbox" id="check-all">
<input type="checkbox" name="c1" />
</div>
</th>
<th></th>
<th class="sorted">Title</th>
<th>Owner</th>
<th>Last Modified</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="checkbox cb">
<input type="checkbox" name="c1" />
</div>
</td>
<td></td>
<td>The Great Gatsby</td>
<td>me</td>
<td>Sep 1</td>
</tr>
<tr>
<td>
<div class="checkbox cb">
<input type="checkbox" name="c1" />
</div>
</td>
<td></td>
<td>To Kill a Mockingbird</td>
<td>me</td>
<td>Sep 1</td>
</tr>
<tr>
<td>
<div class="checkbox cb">
<input type="checkbox" name="c1" />
</div>
</td>
<td></td>
<td>War and Peace</td>
<td>me</td>
<td>Sep 1</td>
</tr>
<tr>
<td>
<div class="checkbox cb">
<input type="checkbox" name="c1" />
</div>
</td>
<td></td>
<td>Catcher in the Rye</td>
<td>me</td>
<td>Sep 1</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section">
<h2>Browser compatibility</h2>
<p>Latest version of Chrome and Firefox.</p>
</div>
<div class="section">
<h2>License</h2>
<p>Public domain: <a href="http://unlicense.org/">http://unlicense.org/</a></p>
</div>
<div class="section">
<h2>Acknowledgements</h2>
<p>Inspired by <a href="http://michaelhenriksen.dk">Michael Henriksen</a>'s <a href="http://github.com/michenriksen/css3buttons">CSS3 Buttons</a>. Icons from <a href="http://somerandomdude.com/projects/iconic/">Iconic pack</a>. And of course, Google.</p>
</div>
</div>
<div class="footer">
<a href="http://github.com/todc/css3-google-buttons">CSS3 Google Buttons</a> by <a href="http://timodonnell.com" title="Website of Tim O'Donnell">Tim O'Donnell</a>.
</div>
<script type="text/javascript">
// Implement checkbox-like buttons
$(".toggle-buttons > .button").click(function() {
$(this).siblings(".button").removeClass("checked");
$(this).addClass("checked");
});
// Implement submenus.
$(".has-submenu").hover(
function() {
var elSubMenu = $(this).children(".menu");
elSubMenu.show().css({ left: elSubMenu.width(), top: 0 } );
},
function() { $(this).children(".menu").hide(); }
);
// Implement buttons with dropdown menus.
$(".button.menu").bind('mousedown', function(e) {
if ($(e.target).is(".button.menu")) {
closeButtonMenus(e);
var pos = $(this).position(),
menuId = $(this).attr("data-menu"),
elMenu = $("#"+menuId),
newLeft = pos.left + parseInt($(this).css("margin-left").replace("px", "")),
newTop = pos.top + $(this).outerHeight();
elMenu.show().css({ left: newLeft, top: newTop });
$(this).addClass("checked"); /* show button in depressed state while menu is out */
}
return false;
});
// Hide any open menus if we click outside of them.
$("body").bind("mousedown", function (e) {
closeButtonMenus();
});
// Implement checkboxes in table.
$(".checkbox").click(function() {
$(this).toggleChecked();
});
$("#check-all").click(function() {
if ($(this).hasClass("checked")) {
$(".checkbox.cb").toggleChecked(true);
} else {
$(".checkbox.cb").toggleChecked(false);
}
});
// Hide any open menus if we click outside of them.
var closeButtonMenus = function(e) {
$('ul.menu').hide();
$('.button.menu').removeClass("checked"); /* remove 'checked' state from menu buttons */
};
// Helper methods for table checkboxes.
$.fn.extend({
toggleChecked : function(checked) {
if (checked != null) {
if (checked) {
this.addClass("checked");
this.children("input[type='checkbox']").attr("checked", "true");
} else {
this.removeClass("checked");
this.children("input[type='checkbox']").removeAttr("checked");
}
} else {
this.toggleClass("checked");
this.children("input[type='checkbox']").toggleAttr("checked");
}
return this;
}
});
$.fn.extend({
toggleAttr : function(attrib) {
if (this.attr(attrib)) {
this.removeAttr(attrib);
} else {
this.attr(attrib, attrib);
}
return this;
}
});
</script>
</body>
</html>