I'm attempting to expand a sticky element to fit the size of the screen. Here is the HTML code I am using:
.large {
height: 200vw;
width: 200vw;
}
.header {
left: 0;
top: 0;
color:white;
position: sticky;
width: 100px;
height: 100px;
background: black;
}
<div class="header">Header</div>
<div class="large">Content</div>
Although this code functions, the element does not stretch as intended. If I modify width: 100px
to width: 100vw
, the sticky positioning to the left becomes dysfunctional. It seems that specifying a relative width and using sticky positioning to the left simultaneously may not be possible.