Just for reference:
<input type="text" name="Username" size="10" style="width:60;height:20;
this is how to change the size of an input button and the text inside it - would this help at all?
Main Topics
Browse All TopicsHello,
I have an application which generates some html pages which contains buttons.
On the left and right part of each button is a space which is not fixed, but depends on button text.
Since i have many buttons in the same line, a lot of space is lost.
How can i tell IE to make fixed left and right margin for buttons?
For strong reasons i can't replace the buttons with combinations of div+href+css. I have to use input type=button, so please do not post solutions that simulate buttons with href or similar.
Thank you,
sey.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
if it is generated with asp you could count the characters it uses and use that as the basis for the width of the button:
and sorry about the above it should be this:
<input type="button" name="something" style="width:60;height:20;
If you could count the characters you could do something like this:
Dim buttonWidth
buttonwidth= 7 '>>how amny chars counted
<input type="button" name="something" style="width:<%=ButtonWidt
How about using something other than actual buttons? You could generate a table with borders and colors that look like buttons and have an onMouseUp, onMouseOut, and onMouseOver events on each individual table column. That would allow you to create events that were similar to buttons but give you control of the width and height of each cell by specifying that your table is 100% and not specifiying a column width each column. This should cause the cellto stretch or shrink based on the amount of space available. Depending on your code this shouldn't be a far cry from how your currently generating buttons in your JSP code.
Just a thought to consider.
Good Luck,
Jeff
"well, i can't introduce this limitation of fixed size font in the application. Anyway, the font don't have fixed char width (Arial or Times), so only the number of characters is not enough to compute the width of button."
Use realtive sizes, font-size: small;
(x-small, medium, etc.)
and you can certainly state the prefered font. If you wan't fixed width fonts, use
font-family: monospace.
Now, you simply need a little math.
As far as margins, you can specify that as well.
<input type="button" value="Button" name="B1" style="border-style:solid;
Business Accounts
Answer for Membership
by: VirusMinusPosted on 2005-02-02 at 07:15:26ID: 13203805
how about giving the input buttons a class and declaring that class with whatever margins you want via external or internal css?