Solved

how to set text alignment for the button

Posted on 2011-09-14
4
235 Views
Last Modified: 2012-06-21
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
Comment
Question by:Sthokala
  • 2
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 36538900
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
 

Author Comment

by:Sthokala
ID: 36539143
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
 

Author Comment

by:Sthokala
ID: 36539408
Thank you..there was some spaces..I removed them
0
 
LVL 30

Expert Comment

by:LZ1
ID: 36539464
Glad you got it!
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question