How to stop these two divs/navbars from overlapping in Bootstrap

Kyle Truong

I've got this page that should be segmented. Using Bootstrap, there's a side block of col-sm-3 for the sidebar, and a body block of col-sm-9 for the main content. I thought if everything added up to 12 columns, everything would be OK, but when I input a nav div thing in the sideblock, it seems to just ignore the whole grid system and pushes the body block downwards, leaving a big empty space in front of the sidebar.

I'm still pretty new to all of this and haven't learned how to properly use css. I used the bootstrap CDN if that matters. Is there anyway to makes the sidebar and the main content share the same row using just the bootstrap CDN? If not, how would I go to implement the css properly in this case?

The block of html giving me problems:

<div class="container-fluid">
  <div class="row">
    <div class="col-sm-3">
      {% block side_block %}
        {% get_category_list category %}
      {% endblock %}
    </div>
    <div class="col-sm-9 col-sm-offset-3">
      <div>
        {% block body %}{% endblock %}
      </div>
    </div>
  </div>
</div> 

and the block of code rendered by {% get_category_list category %}:

{% if cats %}
  <ul class="nav navbar-sidebar">
  {% for c in cats %}
    {% if c == act_cat %}<li class="active"> {% else %} <li>{% endif %}
    <a href="{% url 'category' c.slug %}">{{ c.name }}</a></li>
  {% endfor %}
{% else %}
  <li><strong>There are no categories present.</strong></li>
  </ul>
{% endif %}
Mo Alsaedi

It is a bit difficult to tell what your issue is just by looking, but here are a couple of suggestions:

  1. Check your padding, if you have any custom padding added to grid elements, make sure to add the property (box-sizing: border-box) to those which will make sure the size of the element won't grow with padding. Try to check that on your nav element as well.
  2. Try to remove (col-sm-offset-3) and instead, wrap the two elements above in a row and a (col-sm-12), which will ensure that they both sit in 12 columns which might also help you find out what's happening.

This property might cause some errors, and I wouldn't recommend using it for actual development but it could help shed some light if the issue is indeed related to padding:

in your css, you can do something like:

html,html *{box-sizing: border-box !important;}

Even if this works and resolves the issue, please remove it and proceed to apply the box-sizing property to affected divs only and not html and it's children as it is never recommended to use syntax like this.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to stop these two divs/navbars from overlapping in Bootstrap

From Dev

How to stop <li> elements from overlapping?

From Dev

Stop div from overlapping

From Dev

How to prevent Bootstrap 3 columns from overlapping

From Dev

How to stop an uitableview housed in tabbarcontrol from overlapping the status bar?

From Dev

Beginner's stuff: How to stop CSS' Divs from overlapping?

From Dev

How do I stop 2 divs from overlapping?

From Dev

Stop floating DIVs from overlapping

From Dev

Stop errorbars from overlapping in matlab

From Dev

how to stop text overlapping in textfield

From Dev

Firebase: how to query non-overlapping data from two nodes?

From Dev

CSS: Stop div and img from overlapping

From Dev

Stop ad from overlapping on last item of ListView

From Dev

How to prevent fixed button from overlapping footer area and stop the button on top of where the footer is located

From Dev

How to stop nested list overlapping parent list?

From Dev

How can I stop these buttons overlapping?

From Dev

How to prevent overlapping two bootstrap styled divs which can re-size and drag?

From Dev

How to stop buttons from staying depressed with Bootstrap 3

From Dev

How can I stop a Bootstrap alert from automatically disappearing?

From Dev

How to stop Bootstrap button from defaulting to grey background?

From Dev

how do i stop my bootstrap carousel from changing size

From Dev

Angular JS: how to stop two way binding from happening

From Dev

How to prevent divs from overlapping?

From Dev

stop d3 circle pack labels from overlapping

From Dev

How to capture onTouch events on two overlapping views?

From Dev

How to compute the overlapping ratio of two rotated rectangles?

From Dev

How to prevent overlapping the contents of two column

From Dev

Stop two rectangles from intersecting

From Dev

How do I stop bootstrap-sass gem from loading Bootstrap js twice?

Related Related

  1. 1

    How to stop these two divs/navbars from overlapping in Bootstrap

  2. 2

    How to stop <li> elements from overlapping?

  3. 3

    Stop div from overlapping

  4. 4

    How to prevent Bootstrap 3 columns from overlapping

  5. 5

    How to stop an uitableview housed in tabbarcontrol from overlapping the status bar?

  6. 6

    Beginner's stuff: How to stop CSS' Divs from overlapping?

  7. 7

    How do I stop 2 divs from overlapping?

  8. 8

    Stop floating DIVs from overlapping

  9. 9

    Stop errorbars from overlapping in matlab

  10. 10

    how to stop text overlapping in textfield

  11. 11

    Firebase: how to query non-overlapping data from two nodes?

  12. 12

    CSS: Stop div and img from overlapping

  13. 13

    Stop ad from overlapping on last item of ListView

  14. 14

    How to prevent fixed button from overlapping footer area and stop the button on top of where the footer is located

  15. 15

    How to stop nested list overlapping parent list?

  16. 16

    How can I stop these buttons overlapping?

  17. 17

    How to prevent overlapping two bootstrap styled divs which can re-size and drag?

  18. 18

    How to stop buttons from staying depressed with Bootstrap 3

  19. 19

    How can I stop a Bootstrap alert from automatically disappearing?

  20. 20

    How to stop Bootstrap button from defaulting to grey background?

  21. 21

    how do i stop my bootstrap carousel from changing size

  22. 22

    Angular JS: how to stop two way binding from happening

  23. 23

    How to prevent divs from overlapping?

  24. 24

    stop d3 circle pack labels from overlapping

  25. 25

    How to capture onTouch events on two overlapping views?

  26. 26

    How to compute the overlapping ratio of two rotated rectangles?

  27. 27

    How to prevent overlapping the contents of two column

  28. 28

    Stop two rectangles from intersecting

  29. 29

    How do I stop bootstrap-sass gem from loading Bootstrap js twice?

HotTag

Archive