Reputation: 2399
https://codepen.io/joshuajazleung/pen/YxvgVj
<div>
<span>Hello</span>
</div>
<div></div>
body {
margin: 0;
}
div:first-child {
height: 300px;
background: blue;
-webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
}
div:nth-child(2) {
height: 1000px;
background: red;
}
span {
display: block;
font-size: 3rem;
text-align: center;
position: fixed;
width: 100%;
top: 0;
}
I don't know what, but the fixed-position element stays behind the second div if its parent has the clip-path property. How can I make it stay above all elements?
Upvotes: 0
Views: 2242
Reputation: 86
You can't make a fixed-position element inside a clip-path parent stay above all elements, because clip-path make a new layer, such as you can't use a fixed-position element inside a transform parent.
Upvotes: 2
Reputation: 1829
Is this what you are looking for? I just made some changes in your html..
<div>
</div>
<span>Hello</span>
<div>
</div>
Upvotes: 0