[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

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

0
Sthokala
Asked:
Sthokala
  • 2
  • 2
1 Solution
 
LZ1Commented:
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now