How to align the block to the center if the block position: fixed; ?

margin 0; - does not work. Width is fixed.

    2 answers 2

    For adaptive layout -

     .fixed { position: fixed; left: 0; right: 0; top: 0; margin: 0 auto; width: 50%; height: 50px; background: gray; line-height: 50px; text-align: center; } 
     <div class="fixed">lorem </div 

       div { left: calc(50% - 'половина ширины внутреннего блока'px); }