float when position: fixed

Hello, why does float stop working when setting position? Example:

<div style="position: fixed;">
 <div style="float: left">
  left
 </div>
 <div style="float: right">
  right
 </div>
</div>
Author: ModaL, 2012-09-26

2 answers

The width should be set to the parent in which position: fixed;

 3
Author: markuper, 2012-09-26 12:24:30

For the third block float: right; to do wrong, set width for the blocks and for the second margin-left = width of the first block

    <div style="position: fixed;">
        <div style="float: left; width: 100px;">
            left
        </div>
        <div style="margin-left: 100px;">
            right
        </div>
    </div>
 1
Author: iurii_n, 2012-09-26 14:03:42