I'm currently working on developing a calendar application but facing some challenges with the layout structure.
The main aim is to create a scrollable div
featuring timeline overlays.
This is my progress so far:
.calendar {
position: absolute;
height: 80%;
width: 80%;
top: 0;
left: 0;
margin: 50px;
}
.wrapper {
position: relative;
background-color: lightgray;
width: 100%;
height: 100%;
overflow: scroll;
}
.main {
width: 2000px;
height: 1050px;
background-color: rosybrown;
display: flex;
flex-direction: column;
}
.top {
height: 50px;
position: sticky;
top: 0;
z-index: 1;
background-color: rgba(192, 244, 96, 0.658);
}
.main .middle {
display: flex;
flex-grow: 1;
flex-direction: row;
}
.main .middle {
position: relative;
width: 100%;
left: 0;
background: rgba(255, 107, 49, 0.904);
}
.left {
position: sticky;
width: 50%;
left: 0;
}
.lines {
position: relative;
width: 100%;
}
.line {
position: absolute;
border-top-style: solid;
border-top-color: black;
border-top-width: 1px;
width: 100%;
}
.right {
margin-left: 1rem;
position: relative;
height: 100%;
width: 100%;
background-color: mediumvioletred
}
.items {
}
.item {
position: absolute;
width: 100px;
height: 100px;
background: maroon;
}
<div class="calendar">
<div class="wrapper">
<div class="main">
<div class="top">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae aspernatur eligendi dolorem perspiciatis nesciunt assumenda rem voluptas nam odit, modi optio quis dicta! Quibusdam, nisi qui porro laboriosam at eligendi!
</div>
<div class="middle">
<div class="left">
<div class="lines">
<div class="line" style="top: 100px;">Time</div>
<div class="line" style="top: 300px;">Time</div>
<div class="line" style="top: 500px;">Time</div>
<div class="line" style="top: 900px;">Time</div>
<div class="line" style="top: 1000px;">Time</div>
</div>
</div>
<div class="right">
<div class="items">
<div class="item" stlye="top: 300px"><div>
</div>
</div>
</div>
</div>
</div>
</div>
I am looking to add overlay lines over the "calendar", however, when I set width: 100%;
for the left
div, it affects the positioning of the right
div.
Hopefully that clarifies things. In essence, the desired outcome should resemble this illustration upon scrolling:
https://i.sstatic.net/ztG22.png (I captured this screenshot by scrolling to the correct position)