Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 : fix div row

I have two divs :

<div class="row">
</div>


<div class="row">
</div>

I need to fix the first one while scrolling. I did this :

<div style="position:fixed" class="row">
</div>

Now the divs are overlapping : https://jsfiddle.net/DTcHh/22068/

How can I solve this ?

like image 309
DeseaseSparta Avatar asked Mar 18 '26 03:03

DeseaseSparta


1 Answers

HTML:

<div class="row fixed"></div>
<div class="row padding"></div>

CSS:

.fixed {
  position: fixed;
  background: #fff;
  z-index: 10;
  width: 100%;
}
.padding {
  padding-top: 54px // height of your fixed row, you have to change this value on different screen sizes (using media queries)
}

JSFIDDLE

like image 187
max Avatar answered Mar 20 '26 17:03

max



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!