How to align textarea to center of the page? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to align textarea to center of the page?

3rd Dec 2017, 10:36 AM
Fathima Faheema P.M
Fathima Faheema P.M - avatar
9 Answers
+ 6
Probably your textarea is too wide that center alignment effect simply not visually observable, try to reduce the width, this is tested to align textarea in the middle of screen on Code Playground. <!DOCTYPE html> <html> <head> <title>Center the textarea</title> </head> <body> <div align = "center"> <textarea placeholder="noticeboard" cols="25" rows="15"> </textarea> <br /> <button formaction=stu.php>student</button> <button formaction=fac.php>faculty</button> </div> </body> </html>
3rd Dec 2017, 3:40 PM
Ipang
+ 4
Try to wrap the textarea within a div with align attribute set to center, maybe something like this: <div align="center"> <textarea> Sample text </textarea> </div> Hth, cmiiw
3rd Dec 2017, 1:32 PM
Ipang
+ 4
@Charan Leo25, that's really too kind, but a simple thanks will do just fine for me :) Cheers @All
3rd Dec 2017, 4:54 PM
Ipang
+ 1
<center><textarea placeholder=noticeboard cols=100 rows= 15></textarea></center> <button formaction=stu.php>student</button> <button formaction=fac.php>faculty</button>
3rd Dec 2017, 11:56 AM
Fathima Faheema P.M
Fathima Faheema P.M - avatar
+ 1
iam working for a college project. iam currently coding with pc of windows 7.
3rd Dec 2017, 11:57 AM
Fathima Faheema P.M
Fathima Faheema P.M - avatar
+ 1
thank u all
3rd Dec 2017, 4:11 PM
Fathima Faheema P.M
Fathima Faheema P.M - avatar
0
it does n't work
3rd Dec 2017, 10:55 AM
Fathima Faheema P.M
Fathima Faheema P.M - avatar
0
Not working. Only buttons are aligned center. textarea remains left.
3rd Dec 2017, 3:10 PM
Fathima Faheema P.M
Fathima Faheema P.M - avatar
0
Thanks for this
23rd Aug 2022, 5:35 PM
Adegoke Raphael Adekunle