CSS / HTML centering a textbox
Posted
by Robert
on Stack Overflow
See other posts from Stack Overflow
or by Robert
Published on 2010-06-09T10:56:19Z
Indexed on
2010/06/09
11:02 UTC
Read the original article
Hit count: 551
This should be easy but its proving difficult...
My element I want centred is exactly this <input type="text">
I don't want the text centred, just the text box within the outer div.
This is my attempt which is not working
<div class ="temp123">
<input type="text" />
</div>
Where:
.temp123
{
margin: 0 auto;
margin-left: auto;
margin-right: auto;
}
The text box remains on the left.
The outer div has a fixed with of 300px and itself is centered using margin: 0 auto;
© Stack Overflow or respective owner