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

fixedbar

When I'm trying to make fixed bar for my nav element just like twitter have but I don't want it at the top instead I would like to have it in the center. But position fixed property is not fixing this issue.

When I scroll it scroll with the page

CSS```

fixbar {

position: fixed;
bottom: 40%;
width: 100%;
min-height: 60px;
background-color: steelblue;

}

3 Answers

Ricky Catron
Ricky Catron
13,023 Points

For the life of me I don't know why would would put a fixed element in the middle of the page. I also don't think that code is the issue. I even tested it on the subscribe button of this page and it still scrolls with me. Is is possible you are overriding it elsewhere? On the bright side I have a huge Subscribe button that follows me!

Well I've only one fix bar and second thing nowadays most advance web companies have websites which have main fixed nav bar in the middle of the page but it didn't scroll down with page and it didn't scroll back up when you scroll back.

I'm just trying to test things so I can learn from my mistakes. checkout this website http://www.artandlogic.com/

Ricky Catron
Ricky Catron
13,023 Points

I am pretty sure that pages uses Javascript to change the position to fixed once you pass a break point (I now understand your concept and love the idea). Plus maybe you have a id or class over ruling it? An old browser which doesn't support fixed positioning? I'm just throwing darts right now sorry. Plus great attitude learning from your mistakes is the best way to learn for me too.