How to get <input type="text">
in the center? I want to make a login form but i cannot bring the input on the center
Asked
Active
Viewed 50 times
0

Frowy
- 11
- 2
-
What does "in the center" mean? In the centre of what? (If you want to horizontally centre something, there are hundreds if not thousands of questions already coving that on this site) – DBS Jul 13 '22 at 15:27
-
In the html body – Frowy Jul 13 '22 at 15:28
1 Answers
0
Method 1
Wrap your input
element in a div
and set it's text-align
to center
div {
text-align: center;
}
<div>
<input/>
</div>
Method 2
Set the input
element's display to block
and set its margins
input {
display: block;
margin: auto;
}
<input />

Geeky Quentin
- 2,469
- 2
- 7
- 28