Overflow ignoring the margin

Viewed 45

I have a page with a navbar + content + footer structure. On the footer, I have margin-top. When the content is overflowing, the margin is ignored and there is no space between the content and the footer. I would like to set my content to scrollable when it is overflowing, but overflow-y: hidden/auto/scroll/visible does not work. The content and the footer are separate.

There are three tables on this page. I am using bootstrap for the project.

My Code:

<!--NAVBAR-->
...
<!--CONTENT-->
<div class="container" >
  <div class="row">
    <div class="col">
      <div>
        <h1>title1</h1>
        <table class="table table-striped table-hover table-bordered">...</table>
      </div>
      <div>
        <h1>title2</h1>
        <table class="table table-striped table-hover table-bordered">...</table>
      </div>
      <div>
        <h1>title3</h1>
        <table class="table table-striped table-hover table-bordered">...</table>
      </div>
    </div>
  </div>
</div>

<!--FOOTER-->
<div id="footer">
  <div class="container">
    <div class="row">
      <div class="col-sm-8">
      <!--FOOTER CONTENT-->
      </div>
    </div>
  </div>
</div>

Footer CSS:

#footer {
    margin-top: 3rem;
    position: fixed;
    width: 100%;
    padding: 5px;
    bottom: 0;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    z-index: 999;
}

enter image description here enter image description here

1 Answers

the easy ways my trick, add : <div class="clear"></div>
in the middle footer and container

css:

.clear {
    float: none;
    clear: both;
}

in the #footer css add : float: left;

Related