I'm trying to understand the reason behind this problem:
What's the underlying reason behind <button>
or <input>
elements not behaving like other elements when set to display:block
!
I'm not looking for workarounds to fix this problem, so please don't point me to this answer because it doesn't answer the question.
Here's a js-fiddle that illustrates the problem
Update 1: @Pete is correct, the default size attribute of an element is what sets the size even on block, as you can in this fiddle the size and cols attribute of <input>
and <textarea>
changes their width. That solves part of my question.
With that in mind, my question is now, why is the <button>
element not behaving like other block elements? It's a mystery to me!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…