2

Here is the current situation of my theme:

enter image description here

Fiddle. I don't want a fixed footer, and I don't want a sticky footer with position absolute , I just want to fill the horrible section with footer color , I think that display:table-row will do the trick, but don't know how to use it. Can anyone help me please?

Stickers
  • 75,527
  • 23
  • 147
  • 186
Sadeghbayan
  • 1,163
  • 2
  • 18
  • 38

4 Answers4

1

Here is a simple structure of CSS table + table-row.

html, body {
    height: 100%;
}
body {
    display: table;
    width: 100%;
    margin: 0;
}
header, main, footer {
    display: table-row;
}
header {background: pink;}
footer {background: lightgreen;}
<header>header</header>
<main>main</main>
<footer>footer</footer>

And set height:100% to one of the section if you want it to get maximum height available.

html, body {
    height: 100%;
}
body {
    display: table;
    width: 100%;
    margin: 0;
}
header, main, footer {
    display: table-row;
}
main {
    height: 100%;
}
header {background: pink;}
footer {background: lightgreen;}
<header>header</header>
<main>main</main>
<footer>footer</footer>
Stickers
  • 75,527
  • 23
  • 147
  • 186
0

Here's what you're looking for:

.footer{
    background-color:#000;
    color:#fff;
    position:absolute;
    bottom:0px;
    min-width:100%;
}

JSFiddle

BahaEddine Ayadi
  • 987
  • 9
  • 20
0

The easiest solution I can think of would be to make a content container and give it a background color, then set the body color to the same as the footer like:

body {
    background:#0F0;
}
#header {
    background:#F00;
}
#container {
    background:#FFF;
}
#footer {
    background:#0F0;
}

Fiddle

sharf
  • 2,123
  • 4
  • 24
  • 47
0

just add

  position:absolute;
  bottom:0px;

to .footer

and

position: relative;
  padding-bottom: (n)px;

to body

change (n) to the height of the footer

body {
  position: relative;
 margin:0;
  padding-bottom: 100px;

  font-family: "Helvetica Neue", Arial, sans-serif;
}

.footer{

  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height:100px;
width:100%;
  background-color: #efefef;
  text-align: center;

}
<html><body><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>


<div class="footer">text</div>
</body></html>
xTrimy
  • 804
  • 9
  • 23