javascript - Do you really need a width on floated element? -
say have div (id="toolbar"
), , inside toolbar have div (id="buttonholder"
) contains 2 buttons. if float #buttonholder
right , don't set explicit width on it, kosher?
i've read on stack overflow should set width on floated element. buttons text might change, save apply, , don't want have adjust #buttonholder
's width every time.
i thought setting #buttonholder
's width auto
, browser default seems unnecessary set it's width auto. i'm worried browser might not float #buttonholder
way think should.
a change "save" "apply" isn't going take more room, honest.
in principle, yes should set width - if don't, have button float:left;
, <div>
float:right;
. if don't set widths, they're not going take full screen width, elements put in below going try position in gap between two.
it idea have 100% width container element particular scenario prevent described effects.
Comments
Post a Comment