我可以快速想到两种解决方案。您可以给#headercontainer元素一个z-index CSS 属性...
#headercontainer {
/* ... other CSS ... */
z-index: 1000;
}
Run Code Online (Sandbox Code Playgroud)
……或者你可以按照我认为应该做的方式来做……
#headercontainer {
/* ... other CSS ... */
position: fixed;
top: 0px;
}
#contentcontainer {
/* ... other CSS ... */
margin-top: 125px; /* this should be at least the height of the header */
}
Run Code Online (Sandbox Code Playgroud)
在第二种解决方案中,您不必担心哪个元素悬停在哪个其他元素上。该#contentcontainer元素的下正确下推#headercontainer元素,使他们有没有重叠。
我希望这有帮助。
赫里斯托