how to set text alignment for the button

Hi,
  I created a button using java script, I want to align the text on the button. I am creating button like below. Please let me know how can I align button text.

Thank you
var buttonnode= document.createElement('input');
buttonnode.setAttribute('type','button');
buttonnode.setAttribute('name',i+1);
buttonnode.setAttribute('value',values[1]);
buttonnode.setAttribute('id',values[0]);
buttonnode.style.cssText="font-size :'10';height: 30px;vertical-align: middle;width=95%";

Open in new window

SthokalaAsked:
Who is Participating?
 
LZ1Connect With a Mentor Commented:
How do you want to align it?  Left, center or right?
You could just add that alignment into the last line of your code:

buttonnode.style.cssText="font-size :'10';height: 30px;vertical-align: middle;width=95%;text-align:center;";

Open in new window

0
 
SthokalaAuthor Commented:
Hi, Thank you so much for your reply. Please find the attached image. I want the text to be aligned top and left.

Thank you
Capture.PNG
0
 
SthokalaAuthor Commented:
Thank you..there was some spaces..I removed them
0
 
LZ1Commented:
Glad you got it!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.