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

HTML

HTML elements do not response to margin left and right auto

I can't center input element "search" with the command

searchInput {

text-align : center; width: 70%; margin: 1em auto 0; }

.But i used the following

searchInput {

width: 70%; margin: 1em 15% 0; } to center search input element. My question is why the first css command didn't work thanks in advanced ?

2 Answers

if the display of an element is inline, that element won't accept margin, you can change this by changing the display to block or inline-block

display:inline-block;

Thanks for the Answer. But the display was inline-block