Mijn vorige topic is blijkbaar gesloten. Ik kon ook niet de mensen bedanken die reageerde op mijn topic. Hierbij, dank je wel. : )
Nu mijn vraag. Wanneer ik mijn navbar fixed probeer te krijgen is deze niet fixed op de website. Weet jij wat ik verkeerd doe?
Nu mijn vraag. Wanneer ik mijn navbar fixed probeer te krijgen is deze niet fixed op de website. Weet jij wat ik verkeerd doe?
HTML:
1
2
3
4
5
6
7
| <div id="navbar"> <a href="#home">Home</a> <a href="#news">News</a> <a href="#contact">Contact</a> </div> <div class="page-wrapper"> |
Cascading Stylesheet:
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
| #navbar { overflow: hidden; background-color: #333; } /* Navbar links */ #navbar a { float: left; display: block; color: #f2f2f2; text-align: center; padding: 14px; text-decoration: none; } /* Page content */ .content { padding: 16px; } /* The sticky class is added to the navbar with JS when it reaches its scroll position */ .sticky { position: fixed; top: 10; width: 100%; } /* Add some top padding to the page content to prevent sudden quick movement (as the navigation bar gets a new position at the top of the page (position:fixed and top:0) */ .sticky + .content { padding-top: 60px; |
[ Voor 0% gewijzigd door Creepy op 05-04-2020 00:00 ]