to keep position:fixed
, you may look at transform-style
:
example , 10px
lower , so you can see it.
.header-search {
position: fixed;
left: 0;
top: 0;
background-color: #fff;
width: 100%;
height: 54px;
transform-style: preserve-3d;
}
.header-search::before {
transform-origin: 0 0;
transform: rotatey(1deg);
content: '';
width: 100vw;
height: 54px;
position: absolute;
top: 0;
top:10px;/* see me demo */
left: 0;
background: #f90;
}
body {
background: gray;
<div class="header-search">search header</div>
https://developer.mozilla.org/en-US/docs/Web/CSS/transform-style
The transform-style
CSS property sets whether children of an element are positioned in the 3D space or are flattened in the plane of the element.
also
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
The stacking context is a three-dimensional conceptualization of HTML elements along an imaginary z-axis relative to the user, who is assumed to be facing the viewport or the webpage. HTML elements occupy this space in priority order based on element attributes.