Solved

how to set text alignment for the button

Posted on 2011-09-14
4
233 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you..there was some spaces..I removed them
0
 
LVL 30

Expert Comment

by:LZ1
Comment Utility
Glad you got it!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now