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

Keep nav bar in bottom right of header.

I am using a background image for my header, and I'm curious if there is any way to fix the nav bar in the bottom right of the header using CSS. So far, I've only been able to mess around with margin-top values to get it to the right spot. However, it changes location when I resize the window.

1 Answer

You can use position property to achieve that.

header {
  position: relative; /* Parent container must have position property */
}

nav {
  position: absolute; 
  right: 20px; /* Move the nav 20px from the right side of parent container*/
  bottom: 20px; /* Move the nav 20px from the bottom of parent container*/
}

https://developer.mozilla.org/en-US/docs/Web/CSS/position

Thank you Samuel!