In the following code, when you scroll down the page, the header is scrolled too. I need to fix the header panel marked as green. How can I do that?
This question is asked previously. However, I cannot understand the solution. link
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="panel-body" style="background:rgb(200,255,200)">
aaaa, bbbb, ccc
</div>
<div>
<div>content 1</div>
<div>content 2</div>
<div>content 3</div>
<div>content 4</div>
<div>content 5</div>
<div>content 6</div>
<div>content 7</div>
<div>content 8</div>
<div>content 9</div>
<div>content 10</div>
<div>content 11</div>
<div>content 12</div>
<div>content 13</div>
<div>content 14</div>
<div>content 15</div>
<div>content 16</div>
<div>content 17</div>
<div>content 18</div>
<div>content 19</div>
<div>content 20</div>
<div>content 21</div>
<div>content 22</div>
<div>content 23</div>
<div>content 24</div>
<div>content 25</div>
<div>content 26</div>
<div>content 27</div>
<div>content 28</div>
<div>content 29</div>
<div>content 30</div>
<div>content 31</div>
<div>content 32</div>
<div>content 33</div>
<div>content 34</div>
<div>content 35</div>
<div>content 36</div>
<div>content 37</div>
<div>content 38</div>
<div>content 39</div>
<div>content 40</div>
<div>content 41</div>
<div>content 42</div>
<div>content 43</div>
<div>content 44</div>
<div>content 45</div>
<div>content 46</div>
<div>content 47</div>
<div>content 48</div>
<div>content 49</div>
<div>content 50</div>
<div>content 51</div>
<div>content 52</div>
<div>content 53</div>
<div>content 54</div>
<div>content 55</div>
<div>content 56</div>
<div>content 57</div>
<div>content 58</div>
<div>content 59</div>
</div>
2
Answers
Simply rewrite
to
and add this to your custom CSS-File:
Edit: You can just use Bootstrap’s “navbar-fixed-top”-Class.
Here is your updated Snippet with inline-CSS:
Keep in mind, that you have to adjust your content in this case, because of overlapping containers.
Documentation: http://getbootstrap.com/components/#navbar-fixed-top
Add this
head
to your top header andcontent
to the div containing your contents.