When we apply position:fixed
to an element, it\'s taken out of the normal flow of the document, therefore it doesn\'t respect it\'s parent\'s element width.
Are the
This is likely because of some default margin or padding on the or
element. When it's static, it sizes based on the
's width at the time, but when it changes to
position:fixed
it's sized in respect to the viewport.
As such, removing that default margin/padding should fix the problem (in my experience body { margin:0; }
fixes it) as should changing the sizing when it is fixed (like width:calc(n% - 5px);
).