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

Tracy Nickel
7,430 PointsSearch box center
Trying to center search box in mobile layout under the nav bar li elements. It is sitting slightly to the right.
``css .box { margin: 20px auto; width: 50px; height: 40px; text-align: center; }
``html <div class="box"> <div class="container-1"> <input type="search" id="search" placeholder="Search..."> </div> </div>
2 Answers

Shayne Laufenberg
4,213 PointsSo one of the problems in your code is that you have set your outer layer box class to 50 pixel width, however by default an input's width is much greater than that. So what you need to do is use something called max-width to your outer layer this will limit its width to a maximum of 150px in my solution. Then you set the width of that box to 100% so that the browser by default goes to that limitation u set. If you use this and shrink the screen it will also work because it adjusts to a users screensize using a percentage value. Lastly set your input width to 100% to adjust with the outer layer box so it also is responsive. You can play around with this if you'd like I hope it helps :)
Solution:
HTML:
<div class="box">
<div class="container-1">
<input type="search" id="search" placeholder="Search...">
</div>
</div>
CSS:
.box {
margin: 20px auto;
width: 100%;
max-width: 150px;
height: 40px;
text-align: center;
}
.box .container-1 input{
width: 100%;
}

Tracy Nickel
7,430 PointsThank you