Centering Text | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Centering Text

how do you make a login frame and center text?

31st May 2016, 5:31 PM
Brandon Lydon
Brandon Lydon - avatar
5 Answers
+ 3
You can do the following to align your form both vertically and horizontally to the center of the page. <div style="width: 500px; margin: 200px auto 0 auto;text-align:center;"> <form method="post"> Username: <input type="text" id="user" /><br /> Password: <input type="text" id="pass" /><br /> <input type="submit" value="login" /> </form> </div>
31st May 2016, 8:25 PM
James Flanders
+ 1
It is recommended to use CSS for centering text in HTML 5, per W3C's norm. James provided a good example of using CSS divs. As far as a log in page, you're getting a bit ahead yourself.
4th Jun 2016, 9:00 AM
Josue Flores
Josue Flores - avatar
0
James Flanders
6th Jul 2016, 5:46 AM
Melvin Walker
Melvin Walker - avatar
0
<center>
6th Jul 2016, 6:06 AM
Melvin Walker
Melvin Walker - avatar
0
@ James: nice example...
11th Jul 2016, 1:40 AM
Viney
Viney - avatar