Is it really impossible to make a div fit its size to its content?
You can use display: inline-block
.
You can use:
width: -webkit-fit-content;
height: -webkit-fit-content;
width: -moz-fit-content;
height: -moz-fit-content;
EDIT: No. see http://red-team-design.com/horizontal-centering-using-css-fit-content-value/
ALSO: http://dev.w3.org/csswg/css-box-3/
CSS display
setting
It is of course possible - JSFiddle proof of concept where you can see all three possible solutions:
display: inline-block
- this is the one you're not aware ofposition: absolute
float: left/right