Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button width property ignored?

Tags:

html

css

button

Both Firefox and Safari don't seem to properly render a button specified with a certain width:

<form>
<button>foo</button><br>
<button style="width=200px;height:200px">baz</button>
</form>

Button baz will render with specified height but default width. Same result in both Firefox and Safari.

Is this by design? How can I overcome this?

like image 364
CruftyCraft Avatar asked Jul 06 '10 12:07

CruftyCraft


People also ask

How do you make a button 100 width?

To do so use display: block and width: 100% . This property can be used with <button> element as well as <input> element.

How do you find the height width of a button?

To set height and width to 200px of the above example button, this would be the JS: var myButton = document. getElementById('submit-button'); myButton.


1 Answers

It's a syntax error:

<button style="width=200px;height:200px">baz</button>

Should be:

<button style="width:200px;height:200px">baz</button>
like image 139
David Thomas Avatar answered Oct 09 '22 05:10

David Thomas