简体   繁体   English

标题位置:粘性背景颜色问题

[英]Header position:sticky background-color issue

The background of the page is a linear-gradient and the headers have position: sticky .页面的背景是linear-gradient ,标题有position: sticky As the page gets scrolled down the header is overlapping the image with its background being transparent but I want the header background to have the same linear-gradient scheme as that of the page.当页面向下滚动时,标题与图像重叠,其背景是透明的,但我希望标题背景具有与页面相同的linear-gradient方案。 Thanks in advance提前致谢

Current -当前的 - 在此处输入图片说明

Expected -预期的 - 在此处输入图片说明

code - https://jsfiddle.net/wveufyn2/3/代码 - https://jsfiddle.net/wveufyn2/3/

[EDIT] We cant add the same linear-gradient to the header as its out of sync with the overall color scheme. [编辑]我们不能在标题中添加相同的linear-gradient ,因为它与整体配色方案不同步。

在此处输入图片说明

如果您想随位置移动此标题:粘性

position: fixed;
html {
  background: linear-gradient(218.78deg, #20233A 33.97%, #3A2034 100.71%);
  width: 100%;
  background-attachment: fixed;
}
.flex.spaceBetween {
  justify-content: space-between;
  background: linear-gradient(218.78deg, #20233A 33.97%, #3A2034 100.71%);
  background-attachment: fixed;
}

Done.完毕。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM