这是我第一次来这里,我正在寻找一种在 HTML 或 CSS 中做一种 float 标题的方法。 我的意思是,当您向下滚动页面的一部分时,您就会知道那种网站。 像这样 : https://codepen.io/freeCodeCamp/full/YqLyXB
Blockquote
ea
希望这个问题没有在其他任何地方问,很难用英语找到答案,因为我的法语几乎无法解释! 谢谢,如果你花时间回答。
最佳答案
position: fixed;
将创建一个“固定”在窗口视口(viewport)顶部的标题,并将 float 在网站内容的其余部分之上。
body {
height: 500vh;
background: url('http://www.platonphoto.com/photos/72-1057-a.jpg') top center no-repeat;
background-size: cover;
}
header {
position: fixed;
top: 0;
left: 0;
right: 0;
background: black;
color: white;
padding: 1em;
}
<header>header</header>
关于html - 需要找到如何创建 float 标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42682474/