Please refer to https://jsfiddle.net/6nyh5p40/
position: absolute;
A div is made to behave like an inline element. Remove the property, and we see that the div is behaving as it should, a block element.
My question is: is it just adding a position: absolute to a block element that makes it behave like inline?
Yes, a block element element that has the full width of the parent content area will not be executed when the element is absolutely positioned.
(100% ) , postion: relative; , 100%.
postion: relative;
Mozilla Developer Network:
, . , , , ( , ) , , ( ). , .
: https://developer.mozilla.org/en-US/docs/Web/CSS/position#Notes
, , . , , .
. , ,
display:inline-block;
-, , : . , . , display: block; , <p>. . : . : , float: left;
<p>
. div.
inline
float:left;
, inline.
absolute fixed . width, height.
absolute
fixed
width
height
position:absolute .
position:absolute
https://jsfiddle.net/6nyh5p40/1/ - , .
#x { background: red; height: 100px; position: absolute; } span { background: green; height: 100px; position: absolute; }
<div id = "x">div 1</div>abcd <span>Testing span</span>