Skip to content

Commit 92c577a

Browse files
24.- Bootstrap🌈 de 0 a 100 [Practicas con sticky-top]
Video: https://youtu.be/g7maIU_LUW4
1 parent d2af784 commit 92c577a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

sticky.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,49 @@
1010
<link rel="stylesheet" href="css/bootstrap.min.css">
1111
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"
1212
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
13+
<style>
14+
.sticky-top1 {
15+
position: -webkit-sticky;
16+
position: sticky;
17+
top: 0;
18+
z-index: 1020;
19+
}
20+
.sticky-top2 {
21+
position: -webkit-sticky;
22+
position: sticky;
23+
top: 54px;
24+
z-index: 1020;
25+
}
26+
</style>
1327
<title>Hello, boostrap!</title>
1428
</head>
1529

1630
<body>
31+
<div class="container-fluid bg-success" style="height: 250px;"></div>
32+
<nav class="navbar navbar-light bg-light sticky-top1">
33+
<form class="form-inline">
34+
<div class="input-group">
35+
<div class="input-group-prepend">
36+
<span class="input-group-text" id="basic-addon1">@</span>
37+
</div>
38+
<input type="text" class="form-control" placeholder="Username" aria-label="Username"
39+
aria-describedby="basic-addon1">
40+
</div>
41+
</form>
42+
</nav>
43+
<div class="container-fluid bg-success" style="height: 250px;"></div>
44+
<nav class="navbar navbar-dark bg-dark sticky-top2">
45+
<form class="form-inline">
46+
<div class="input-group">
47+
<div class="input-group-prepend">
48+
<span class="input-group-text" id="basic-addon1">@</span>
49+
</div>
50+
<input type="text" class="form-control" placeholder="Username" aria-label="Username"
51+
aria-describedby="basic-addon1">
52+
</div>
53+
</form>
54+
</nav>
55+
<div class="container-fluid bg-danger" style="height: 2500px;"></div>
1756

1857
<!-- Optional JavaScript -->
1958
<!-- jQuery first, then Popper.js, then Bootstrap JS -->

0 commit comments

Comments
 (0)