Content section overlap footer

Jack

I have a a page as following that works fine in big screens but in small screens the mainsection overlap the footer. How can I have the footer always at the bottom of the page. Also in small screens the location of the footer should be based on content of the page. In other words, if content is lengthy it should push footer to the bottom of the page. None of them should overlap the other.

DEMO

Code

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet"
    href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet"
    href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

<link rel="stylesheet"
    href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.2.1/bootstrap-social.css">

<style>
footer {
    bottom: 0;
    height: 60px;
    position: absolute;
    width: 100%;
}
body {
    margin-bottom: 60px;
}
html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
}
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.mainsection{
    width: 100%;
    margin: 0 0 1em 0;
    box-shadow: 0px 0px 1px 1px black;
    background: white;
    display: flex;
}

.innersection {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    max-width: 1900px;
    width: 100%;
    margin: 0 auto;
    padding: 1em;
}

.mainsection>img {
    height: 74px;
    width: 120px;
    margin: 0 5px 0 0;
}

.mainsection>span {
    width: calc(100% - 55px);
    margin-left: 2%;
}

@media ( min-width :599px) {
    .mainsection{
        width: 49%;
        margin: 0 2% 1em 0;
    }
}

@media ( min-width :599px) and (max-width:1024px) {
    .mainsection:nth-child(2n + 2) {
        margin: 0 0 1em 0;
    }
}

@media ( min-width :1024px) {
    .mainsection{
        width: 24%;
        margin: 0 1.3333333333% 1em 0;
    }
    .mainsection:nth-child(4n + 4) {
        margin: 0 0 1em 0;
    }
}
<!--
/
mainsectionisements
-->
</style>
</head>

<body>

<div class="container">
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
</div>
<ul class="innersection">
    <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>

</ul>



    <footer>

<p>This is the footer.This is the footer.This is the footer.This is the footer.This is the footer.</p>
</footer>
</body>
</html>
Dmitriy
  1. remove - position: absolute for footer
  2. create wrapper for page content to push down footer

html,
body {
  height: 100%;
}

body {
    margin: 0;
    padding: 0;    
}

.wrapper {
  min-height: 100%;
  height: auto;
  /* Negative indent footer by its height */
  margin: 0 auto -60px;
  /* Pad bottom by footer height */
  padding: 0 0 60px;
}

footer {
    bottom: 0;
    height: 60px;
    width: 100%;
    background: #ccc;
}

*{
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.mainsection{
    width: 100%;
    margin: 0 0 1em 0;
    box-shadow: 0px 0px 1px 1px black;
    background: white;
    display: flex;
}

.innersection {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    max-width: 1900px;
    width: 100%;
    margin: 0 auto;
    padding: 1em;
}

.mainsection>img {
    height: 74px;
    width: 120px;
    margin: 0 5px 0 0;
}

.mainsection>span {
    width: calc(100% - 55px);
    margin-left: 2%;
}

@media ( min-width :599px) {
    .mainsection{
        width: 49%;
        margin: 0 2% 1em 0;
    }
}

@media ( min-width :599px) and (max-width:1024px) {
    .mainsection:nth-child(2n + 2) {
        margin: 0 0 1em 0;
    }
}

@media ( min-width :1024px) {
    .mainsection{
        width: 24%;
        margin: 0 1.3333333333% 1em 0;
    }
    .mainsection:nth-child(4n + 4) {
        margin: 0 0 1em 0;
    }
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<div class="wrapper">
<div class="container">
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
    <p>This is the container body</p>
</div>
<ul class="innersection">
    <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>
        <li class="mainsection"><span class="content"> <strong>This is Title</strong> <br /> <a href="tel:111111">111 111 111</a>
            <p>This is line 3</p>
            <p>This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.This is line 4.</p>
    </span></li>

</ul>
</div>


    <footer>

<p>This is the footer.This is the footer.This is the footer.This is the footer.This is the footer.</p>
</footer>

Fiddle

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Footer logos aren't aligning correctly and overlap with footer content

From Dev

Getting a footer to stay at bottom of WINDOW (not page) & not overlap content

From Dev

Getting a footer to stay at bottom of WINDOW (not page) & not overlap content

From Dev

Overlap image onto another section while pushing content out of the way

From Dev

Let UIImageView in header section of UITableView overlap the content cells

From Dev

Prevent scroller sidebar to overlap with footer

From Dev

Positioning causes body to overlap with footer

From Dev

Gradient not appearing in the footer section

From Dev

footer different section heights

From Dev

<footer> Text displaying beside the <section> element content instead of displaying in new line

From Dev

<footer> Text displaying beside the <section> element content instead of displaying in new line

From Dev

How to overlap various content?

From Dev

section position: fixed overlaps footer

From Dev

Making a TableViewCell Section Footer Transparent

From Dev

Scrolling tableView section footer and header

From Dev

Making a TableViewCell Section Footer Transparent

From Dev

"rubberband" section in footer with css only

From Dev

Deleting a footer of a section VBA macro

From Dev

How to animate UITableView section footer

From Dev

Scrolling tableView section footer and header

From Dev

How to make footer not overlap and positioned properly?

From Dev

Angular material tabs overlap footer in chrome

From Dev

Change footer content in magento

From Dev

Content goes above footer

From Dev

Footer that moves with content

From Dev

Footer content not floating to right

From Dev

Put footer content in columns

From Dev

Align content in a fixed footer

From Dev

Content overlaps footer

Related Related

  1. 1

    Footer logos aren't aligning correctly and overlap with footer content

  2. 2

    Getting a footer to stay at bottom of WINDOW (not page) & not overlap content

  3. 3

    Getting a footer to stay at bottom of WINDOW (not page) & not overlap content

  4. 4

    Overlap image onto another section while pushing content out of the way

  5. 5

    Let UIImageView in header section of UITableView overlap the content cells

  6. 6

    Prevent scroller sidebar to overlap with footer

  7. 7

    Positioning causes body to overlap with footer

  8. 8

    Gradient not appearing in the footer section

  9. 9

    footer different section heights

  10. 10

    <footer> Text displaying beside the <section> element content instead of displaying in new line

  11. 11

    <footer> Text displaying beside the <section> element content instead of displaying in new line

  12. 12

    How to overlap various content?

  13. 13

    section position: fixed overlaps footer

  14. 14

    Making a TableViewCell Section Footer Transparent

  15. 15

    Scrolling tableView section footer and header

  16. 16

    Making a TableViewCell Section Footer Transparent

  17. 17

    "rubberband" section in footer with css only

  18. 18

    Deleting a footer of a section VBA macro

  19. 19

    How to animate UITableView section footer

  20. 20

    Scrolling tableView section footer and header

  21. 21

    How to make footer not overlap and positioned properly?

  22. 22

    Angular material tabs overlap footer in chrome

  23. 23

    Change footer content in magento

  24. 24

    Content goes above footer

  25. 25

    Footer that moves with content

  26. 26

    Footer content not floating to right

  27. 27

    Put footer content in columns

  28. 28

    Align content in a fixed footer

  29. 29

    Content overlaps footer

HotTag

Archive