I'm facing an issue where the vertical label "PINK" is centered perfectly in a section, but when I scroll down to the next section, it gets covered by a section with a higher z-index.
div.back1 {
background-color: #FF00FF;
position: relative;
width: 100%;
height: 2000px;
z-index: 10;
}
div.text1 {
transform: rotate(-90deg);
position: fixed;
top: 50%;
background-color: #FFFFFF;
z-index: 20;
}
div.back2 {
background-color: #0000FF;
position: relative;
width: 100%;
height: 2000px;
z-index: 30;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="text1">PINK</div>
<div class="back1"></div>
<div class="back2"></div>
</body>
</html>
My goal is to add a second title "BLUE" in the next section and make it visible like in the provided mockup.
https://i.sstatic.net/JcaYj.jpg
Is there a way to adjust the z-indexes to achieve this layout? Are there alternative methods to clip the labels while maintaining their alignment at 50% of the viewport?
Thank you in advance for any help or suggestions!