http://jsfiddle.net/1351qL91/
<div style="width:200px">
<span style="float:left">left</span>
<span style="float:right">right</span>
<br/>
<div style="position:relative">
<span style="float:left">left</span>
<span style="float:right">right</span>
<div>
<br/>
<div style="position:fixed">
<span style="float:left">left</span>
<span style="float:right">right</span>
</div>
spans with float right won't float right inside a div with position fixed.
I came to the conclusion that float won't work if the container's width is unknown, and in this case the width is indeed unknown.
So another question which may solve this problem is how to set a fixed position child to 100% width of it's parent?
P.S I'm using bootstrap 3, which means the container div (which I set to 200px) is actually of class col-md-3 -> I don't know the width of the container, that's why I need it to be dynamic
Floating wont work inside fixed or absolute divs unless you specify width.
You cannot use position:fixed to position inside the bootstrap grid. Fixed positioned divs are relative to the browser. You need to use absolute positioning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With