HTML - set button size
Diva
-
Utilisateur anonyme -
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!
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
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
<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
<[/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 it doesn't work...