How to align the elements of the <input> tag to the center on HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How to align the elements of the <input> tag to the center on HTML?

I want to align the elements of the <input> tag to the center of the webpage. But no idea how to that. I have tried <input align="center"> but it didn't work..

5th Aug 2019, 3:26 PM
Ahammed-E-Sadik🇧🇩🇧🇩🇧🇩
Ahammed-E-Sadik🇧🇩🇧🇩🇧🇩 - avatar
6 Answers
+ 7
CSS Pro Tips: Centering Elements by Domino https://www.sololearn.com/post/37760/?ref=app
5th Aug 2019, 9:23 PM
Gordon
Gordon - avatar
+ 6
put the <input> tag in a <div> container: <div style="text-align:center;"><input /></div>
5th Aug 2019, 3:52 PM
Michael
Michael - avatar
+ 6
But the all input in one div tag, then align the div tag to the center!
5th Aug 2019, 4:01 PM
CodeFu
CodeFu - avatar
+ 2
input is an inline element so to align it to the center ,you have to englobe it in a block element and apply some css to it.
7th Aug 2019, 8:51 AM
Linda Yesso
Linda Yesso - avatar
+ 1
Align doesn't work on img either. For these you have to put them in a container and align the container.
6th Aug 2019, 11:09 PM
Sonic
Sonic - avatar
0
php call. php
7th Aug 2019, 3:20 AM
Anggara Axcal
Anggara Axcal - avatar