Complete the code to make the header stay fixed at the top of the page.
header {
position: [1];
top: 0;
width: 100%;
background-color: lightblue;
}Using position: fixed; makes the header stay fixed at the top of the page even when you scroll.
Complete the code to make the sidebar stick to the top when scrolling past it.
.sidebar {
position: [1];
top: 0;
background-color: lightgray;
height: 200px;
}position: sticky; makes the sidebar stick to the top of the viewport when you scroll past it.
Fix the error in the code to make the footer fixed at the bottom of the page.
footer {
position: [1];
bottom: 0;
width: 100%;
background-color: lightgreen;
}position: fixed; with bottom: 0; fixes the footer at the bottom of the viewport.
Fill both blanks to create a sticky navigation bar that sticks 10px from the top.
nav {
position: [1];
top: [2];
background-color: coral;
padding: 1rem;
}Using position: sticky; with top: 10px; makes the nav bar stick 10 pixels from the top when scrolling.
Fill all three blanks to create a fixed header with a sticky subheader below it.
header {
position: [1];
top: 0;
background-color: navy;
color: white;
padding: 1rem;
}
.subheader {
position: [2];
top: [3];
background-color: lightblue;
padding: 0.5rem;
}The header is fixed at the top with position: fixed;. The subheader is sticky and sticks 3rem below the top, so it stays below the fixed header.