Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Layout Basics Positioning Page Content Positioning Elements Relative to Other Elements

Andrew Lim
Andrew Lim
8,004 Points

absolutely positioned elements vs sticky footer?

It seems that using the absolute position of 0 would achieve the same effect as the sticky headers and footers.

Would you use this method and possibly use a padding or margin to offset the content. Or would the previously described method from another course (See below) be better?

.wrap { min-height: calc(100vh - 25px); }

Jamie Carter
seal-mask
.a{fill-rule:evenodd;}techdegree
Jamie Carter
Front End Web Development Techdegree Student 12,096 Points

I think sticky means that it is not fixed to the browser, until you scroll past a certain point.

Eg the nav may be under the website hero/header and then as you scroll and it touches the top of the page it then sticks and remains there.

As for the position, you could us bottom: 0; to fix the to bottom of the window

.wrap { 
position: fixed; //or abosolute
bottom: 0;
}

1 Answer

The big issue with using position absolute with a footer is if your content is longer that the viewport of the browser (you need to scroll to down the page to view content), then the footer will always be visible and cover the content of your page.