![size submit button text html size submit button text html](https://i.stack.imgur.com/1hVK1.png)
I present this as a challange to the pros and I'll fax coffee and donut to the one who solves it.
#Size submit button text html full
A button with the word Hi takes up only as much space as the text with only tiny padding at each end.Ī button with the word "scooby doo" on it will take up this space:Ī button with text like "scooby doo's treats" becomes:Īfter spending a full day, I've concluded there is simply no solution short of defining the size of each one individually. Here's the way I see it - if you have buttons with different text or values, there is nothing you can do about the crazy size they become.Ī button with the word "kit" on it takes up this space: This means that the width will change depending on the font size both the. From a display perspective, one character is equivalent to 1 em (actually that’s the definition of the em CSS unit).
Forgot to set the font size on the hidden span The size attribute of the element controls the size of the input field in typed characters.This may affects its display size, but somewhat indirectly.But it's the best my little old noodle could come up with. Give it a try and you'll see what I mean about the relative imprecision of this method. The basic idea is to make a function that gets the value of the button, then set an inline element to that value, check the offsetWidth of the element and then set the button to that.e.g., The only other thing I know of, is you can use JavaScript to dynamically 'gestimate' the sizes, but it's not usually very precise when I've tried to do that and is a bit of a kludge.
![size submit button text html size submit button text html](https://res.cloudinary.com/practicaldev/image/fetch/s--Ci44rXQi--/c_imagga_scale,f_auto,fl_progressive,h_1080,q_auto,w_1080/https://cl.ly/073i3k3V3f2j/Image%202018-05-01%20at%2012.56.21%20PM.png)
![size submit button text html size submit button text html](https://d33v4339jhl8k0.cloudfront.net/docs/assets/573acfa69033602af6969ed2/images/5b86aa512c7d3a03f89e3d0d/file-1Mo4PySBrB.gif)
You could make several classes for different sizes, like tiny, small medium and large, and then group your buttons by those, but that wouldn't really help if all the button values are basically autonomous.