Html 如何在固定背景上设置固定内容?
我想知道很长一段时间了,你怎么能在固定的背景上固定文本内容 这是我的代码来解释它: CSSHtml 如何在固定背景上设置固定内容?,html,css,Html,Css,我想知道很长一段时间了,你怎么能在固定的背景上固定文本内容 这是我的代码来解释它: CSS .background { background-attachment: fixed; width: 100%; height: 400px; } .fixed-content { position: fixed; } HTML <div class="background"> <div class="fixed-content">
.background {
background-attachment: fixed;
width: 100%;
height: 400px;
}
.fixed-content {
position: fixed;
}
HTML
<div class="background">
<div class="fixed-content">Test</div>
</div>
试验
第二个div
的类中有一个输入错误。在你的代码中是相同的,还是你只是在写问题的时候犯了错误?我在这里发表文章的时候写错了。你是什么意思?你需要更清楚你想要什么。第二个div
的类有一个输入错误。在你的代码中是相同的,还是你只是在写问题的时候犯了错误?我在这里发表文章的时候写错了。你是什么意思?你需要更清楚你想要什么。