假设我position: fixed
在右上角有一个带有倾斜<h1>
元素 ( ) 的固定位置标题 ( tranform: rotate(33.3deg)
)。如何让主要内容在<h1>
元素下方但在父<header>
元素上方滚动?
我试过使用直接z-index
规则,它适用于 Firefox,但不适用于 chrome。
简而言之:
header {
position: fixed;
top: 0;
right: 0;
z-index: 0;
}
header h1 {
transform: rotate(33.3deg);
z-index: 9;
}
这在 Firefox 中有效,但在 Chrome 中,孩子<h1>
与父母一起进入内容之下<header>
在这件事上,将标题夹在内容周围很重要,因为该transform: rotate()
规则将在转换后的子项周围创建一个巨大的框以将其全部放入其中,例如使超链接无法单击。