I'd like to clarify whether it's possible or not to make a div fit its size based on the content's size without having to make elements float or having to make their position absolute. Is it possible?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
you can also use
when nothing seems working this works always ;)
You can use
display: inline-block
.CSS
display
settingIt 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
You can use:
EDIT: No. see http://red-team-design.com/horizontal-centering-using-css-fit-content-value/
ALSO: http://dev.w3.org/csswg/css-box-3/