[Webinar] Streamline your web hosting managementRegister Today

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

css for form buttons?

with css, i was able to define the font for form buttons, but is it possible to define the width of a button?

my button looks like this now:
------
| OK |
------

but i want
-------------
|    OK     |
-------------

is this possible? how? thank you

0
radioH
Asked:
radioH
  • 6
  • 5
  • 4
  • +3
1 Solution
 
DreamMasterCommented:
hello radioH,

unfortunately i must say that this is something that is not possible if You use the standard buttons of HTML.

what people usually do if they want a special size buttons is create one using for example PhotoShop...sorry!

Max Davidse
http://www.thekitchen.nl
0
 
GnissmanCommented:
A quick and dirty way that nevertheless works:

Label it "     OK     " instead of "OK",
this will make the button wider.

Gniss
0
 
DreamMasterCommented:
Gniss > That's one dirty solution lol....

they would have to be non braking spaces though....
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
GnissmanCommented:
dirty -> yes
  -> no, ordinary spaces will do!

Gniss
0
 
HolySpiritCommented:
"   OK   " is the current solution for me too. By the way, who have a better solution ???

-- Holy Spirit is very HOLY
0
 
nettromCommented:
you can specify the width of the buttons, but it won't work in Netscape.  it will work in IE4/5 (and Mozilla, if you've got that).

how to do it:

create a class or ID for your button(s), or enter the style information directly.  example:

<input type="button" class="mybuttons" ... >

and in the style sheet

..mybuttons { width: 140px; }

if you only have one or two buttons it's probably easier to stuff it in directly:

<input type="button" style="width:140px;" ... >
0
 
cabrionetCommented:
You must use the tag &nbsp; (insert it before and after label in html source)

name="&nbsp;OK&nbsp;"

If you want more width... just duble the tag &nbsp;  
0
 
GnissmanCommented:
cabrionet: Please read the whole thread before posting a comment or even an answer. Everything you wrote has been mentioned by others in this thread before, so there is no need to block the discussion with an answer.

As you are quite new to EE let me explain to you that you normally first give a comment, so that the question remains open for all to see and participate. Please only post as answer when you are absolutely sure that your answer is the one and only right thing!

Gniss
0
 
cabrionetCommented:
Gnissman:
1) I am new to the EE. (first day)
2) I am absolutely sure that this is the only way. I don want that other users use time fore something that is answered!
2) There is 1 option left. You can use
(press and hold shift and press nubers 0 1 6 0)
this sign instead &nbsp;

I am positive that this is the only way!

I wish you a nice day;

Cabrio

P.S.: What kind of server do you use Gniss
0
 
DreamMasterCommented:
cabrionet > i have only one thing to say......and that is....it is NOT up to You to decide if a question is answered...it's up to the one asking the question...this person evaluates the comments he/she gets and finds the answers that help him/her...if the question is answered according to him/her....he/she will accept a comment as an answer....that's all i wanna say about this...

Max Davidse
0
 
GnissmanCommented:
It's not a question of the webserver you use, because the server only delivers the documents. All formatting is done in the browser.

The brwosers will replace s sequence of spaces by one single space, therefore you need to use non-breaking-spaces in normal text if you want to have bigger spaces between words.

But this is *not* the case in the parameters you specify in the tags. You can just set label="    OK   " and the browser will leave it like that and display a wider button.

Just try it!

Gniss
0
 
cabrionetCommented:
DreamMaster: Ok i understand you... but if you are sure then i think that it is the only option that you answer the question. Yes sure he will evaluate the anwser. And my anwser is final. There is not any ather option.

0
 
cabrionetCommented:
Gnissman: I know... I am webmaster also... :) On witch platform do you have server (ms, linuxs, iss, apache)...
0
 
GnissmanCommented:
cabrionet: HPUX

....but let's not make this thread a private discussion, OK?
0
 
DreamMasterCommented:
cabrionet > i agree that if one is sure, one should answer the question...and i believe you when you say that you think you have the only option in your answer...but the fact remains that you didn't add anything new...end of discussion....
0
 
nettromCommented:
I have to agree with DreamMaster here, and I'd also like to point out that my suggestion qualifies as an answer provided the person asking it doesn't matter the caveats that apply.

not to mention the fact that nothing new came up.

but I'm certain that Cabrionet has understood how E-E works now. :)
0
 
cabrionetCommented:
Ok guys;

Just one more thing. When i will ask a question i wish that i will get just one anwser. (final and right) And not 10 people with 2 much time talking about who is right.

P.S.: About my comment - making space with asci 0160 this is the best trick... and compatible with multiple browsers... I submited the anwser because i am trying to help...

If somebody has a problem with this... mail me and leave all the people out of this :)

questions@cabrionet.com
0
 
radioHAuthor Commented:
nettrom, what if i want to accept your answer, i am not sure how to do that.

your answer was actually what i was looking for, but too bad netscape doesnt support it.

thanks all who posted solutions
0
 
cabrionetCommented:
cabrionet changed the proposed answer to a comment
0
 
nettromCommented:
I believe there should be an option for you to select a comment as the answer to the question.  to make things easier I can mark this comment as an answer.  I'll grab the opportunity to ellaborate a bit on the width-thing.

the width of the buttons can be controlled through CSS, but is not supported by other browsers than IE4/5 and Mozilla.  you can either define it directly through the STYLE attribute, or create a class or ID for your button(s) and define it in either an inline or linked style sheet.  an example of defining it directly:

<input type="button" style="width:140px;" ... >

this defines the button's width to be 140 pixels.  since this is CSS you can use all the different CSS values to define it.   see http://www.w3.org/TR/REC-CSS2/visudet.html#the-width-property for the exact definition.

:)
0
 
HolySpiritCommented:
nettrom,
I think it is a better solution instead of typing spaces, thx.

i think radioH should give him marks.
-- Holy Spirit
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 6
  • 5
  • 4
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now