I have an issue with <button>
nodes that refuse to extend their container and, at the same time, fill the container. Update: The issue only appears in Firefox 42, not in Chrome 47.
<!-- This one has a limited width -->
<div class="outer">
<!-- This one is positioned absolutely and shall be extended -->
<div class="container btn1" style="top: 0px">
<!-- These shall extend the container and fill the whole width -->
<button>Some lengthy label for the button</button>
<button>Another label</button>
<button>Still another label</button>
</div>
</div>
Probably, this example demonstrated the issue best: http://jsfiddle.net/5dh4j0hy/1/
I already found out that <button>
is a "replaced element", which is the reason for my problems:
- Why doesn't "display: block" & "width: auto" stretch a button to fill the container?
- What is it in the CSS/DOM that prevents an input box with display: block from expanding to the size of its container
What I could not find out is: How do I solve my specific issue? As the fiddle demonstrates, width: 100%
and width: auto
do not achieve the desired result. And as this is no problem with borders or padding, box-sizing: border-box
is not if relevance here, either.