How can I horizontally center the DIV with the textbox and button on this URL: http://tinyurl.com/d4lpyh5?
Regards, Kevin
margin-left: auto; and margin-right: auto divide the remaining width in half between them with the result that the element is centered. That gets you much closer, but it isn't the everything. (And unfortunately it doesn't change appearance even a little bit although it's right.)
The reason the element doesn't look centered yet is the element is by default the full width of the container/screen. So to make horizontal centering work, you need to not only specify left and right auto margins, but go further and explicitly set the width of the element.
One would like to be able to specify something like "width: minimum-needed;" so it would adjust automatically to whatever it contained ...but there's no such thing in CSS. The only way I know is to explicitly specify the width of the element in a way that makes sense for what you know are its contents.
So here below for example is your code modified so it looks like my understanding of what you desire (there's probably an extra
Page