blade-sensei / learning

Roadmap for software engineer, sandbox, algorithms training, it also contains my daily task dashboard
9 stars 2 forks source link

how to create a sticky footer #33

Closed blade-sensei closed 4 years ago

blade-sensei commented 4 years ago

implementing or blog website deploy to server

blade-sensei commented 4 years ago
html {
    position: relative;
    min-height: 100%;
}
body {
    margin: 0 0 100px; /* bottom = footer height */
}
#bottom-footer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 100px;
    width: 100%;
}

Solution

blade-sensei commented 4 years ago

we can also use

html {
height: 100vh
}

to adapt all the body/html content to fit in the viewport

blade-sensei commented 4 years ago

difference. height on pourcent and vh

pourcent. adapts to the parent height/width vh adapts to the viewport

https://www.sitepoint.com/css-viewport-units-quick-start/