0

I have next structure:

  1. first fixed div for navigation
  2. second fixed div that can be visible or hidden
  3. third div container that scroll under the first div or first and second div.

How to add this second div, so that container is on right position, when this div is visible or hidden?

<div class="navbar navbar-default navbar-fixed-top">
 ...
</div>
<div style="position:fixed; margin-top:50px">...</div>
<div class="container">...</div>
cashmere
  • 885
  • 3
  • 12
  • 37

1 Answers1

1

The easiest is to use the style visibility: hidden instead of display: none when you want to hide your div: this way it will still be at the same place in the document model, yet "invisible"

You can also use opacity: 0 which does the same.

floribon
  • 19,175
  • 5
  • 54
  • 66
  • Problem with second fixed div is that I need to put on container margin-top:100px, But when is hidden or not showing at all, div container is not below first div. Now, it should have margin-top:50px; When I have second div visible, I need to calculate margin-top for container div, So, is it possible to have the structure without this calculation? – cashmere Jan 26 '15 at 23:58