HTML - set button size

Diva -  
 Utilisateur anonyme -
Hello,

I'm trying to make several buttons of the same size, but their size varies depending on the text on the button...

I'm talking about form buttons like this:

<form>
<input type="button" name="name"...

I tried using width and size, but it doesn't work. Does anyone have the solution? Thanks!

5 answers

maw
 
I asked myself the same question in a project, and I'll give you the solution with a clear example:

<input type="submit" value="Send" style="width:130px">

In fact, you just need to add the style attribute, which allows you to define the button size in pixels. You set the same size on all your buttons, and it's done.

Good luck.

Maw
84
Bonobo
 
Yes, and furthermore, since you are incorporating a line of CSS, you can also take the opportunity to add some modifications and decorations (color, effects, and more).
0
tryan44 Posted messages 1289 Registration date   Status Member Last intervention   220
 
@Bonobo: you should check the dates from time to time before posting... May 25, 2005 at 2:12 PM!
-9
Humain
 
His comment is no less relevant... and useful ;-)
0
test
 
Absolutely!!
0
Anonymous user
 
Except that I don't know how to combine this code:


<[/contents/242-introduction-au-dynamic-html-dhtml div] class="box"> <button>Start now</button> <style> button{ font-size: 10em; font-family: Arial, Helvetica, sans-serif; padding: 10px; border: none; background-color: green; color: white; border-radius: 3px; box-shadow: 6px 6px 20px 4px rgba(0, 0, 0, 0.3); cursor: pointer; outline: none; transition: 0.2s; } button:hover{ transform: scale(1.01); box-shadow: 6px 6px 25px 4px rgba(0, 0, 0, 0.18); } button:active{ transform: scale(0.98); box-shadow: 6px 6px 18px 2px rgba(0, 0, 0, 0.23); } </style> </div>

and
width: 200px; height: 150px;
it doesn't work...
0