I’m working on the Landing page project and I don’t understand why the header element does not take up the whole width of the screen. By trial and error I now know the positon:fixed is causing this (if removed, it is OK).
Hi @lucretat and welcome to the forum!!!
With the position property set to fixed, to take up the whole width of the screen you need to set width property to 100%.
.class {
position: fixed;
top: 0;
width: 100%;
}
I link, in my opinion, the complete answer about your question.
Thanks, I figured that 100% width as well and read the answer. However, still not completely clear on the topic… The fixed element (if width is not specified) should take up the width of the viewport, right? The viewport is the whole screen size, is it not? So I should see the header having the width of the window, correct? However, I see this instead: