| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>027 position: sticky</title>
- <style>
- html, body { margin: 0; padding: 0; background: #ffffff; color: #202020; }
- body { font-family: sans-serif; font-size: 14px; }
- h1 { font-size: 20px; margin: 10px 0 4px 10px; }
- p { margin: 0 0 12px 10px; }
- .header { position: sticky; top: 0; height: 40px; background: #333333; color: #ffffff; padding: 8px; font-size: 18px; }
- .content { padding: 0 10px; }
- .after { background: #cc3333; color: #ffffff; height: 30px; margin-top: 20px; padding: 6px; }
- </style>
- </head>
- <body>
- <h1>027 · position: sticky</h1>
- <p>Scroll down: the dark header must stay at the top of the page area.</p>
- <div class="header">Sticky header</div>
- <div class="content">
- <p>Line 1: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 2: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 3: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 4: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 5: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 6: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 7: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 8: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 9: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 10: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 11: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 12: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 13: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 14: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 15: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 16: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 17: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 18: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 19: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 20: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 21: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 22: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 23: the quick brown fox jumps over the lazy dog.</p>
- <p>Line 24: the quick brown fox jumps over the lazy dog.</p>
- </div>
- <div class="after">end of content</div>
- </body>
- </html>
|