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


Setting element to fixed position breaks its width out of container

I am setting my .buttons div to fixed, but now its (100%) width does not match the containers. Any ideas how to fix this?

Here's the image of the site: http://imgur.com/ppcinkk


<div id="create-advert" class="container">
        <form id="create-advert-form" action="" method="POST">

            <div class="buttons">
                <button id="next-button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" type="button">Continue</button>


  position: fixed;
  bottom: 0px;
  width: 100%;

.mdl-button {
        width: 100%;
        height: 40px;
        margin: 20px 15px 20px 0;

Thanks to anyone that helps!

1 Answer

Steven Parker
Steven Parker
228,991 Points

Are you sure you want to use fixed position on these items? Fixed elements are not part of the normal document flow, and are positioned relative to the window, not to their containers.

Maybe you want to use fixed position on the containers instead?

Yes, There are other components in the page and form.