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 trialNicholas Wallen
12,278 PointsWhy did he use width: auto on the media query?
It may be a dumb question, but I typically try to play with the code after he shows us, just so I can see exactly what each line does to it.
How come display: inline-block by itself just doesn't make it display next to eachother? How come we needed to add width: auto?
1 Answer
Truong Minh Nguyen
12,587 PointsI think it's because the default width of <input> is 100% so by using width: auto, the width of the input is just its content's width plus padding, border and margin, which makes the buttons smaller so they can fit onto 1 line.
Mohammed Ali
11,134 PointsMohammed Ali
11,134 Pointsmargin: auto
is used to center block level elements.inline-block
puts elements side by side as you say but doesn't center element in container/div. Here's couple good links if you want play/explore more about these. Centering CSS by CSS-Tricks , Margin: auto by Learn Layout. I hope that' helps.