我有以下嵌套:
body {
app-root {
app-block-page {
app-block-content {
div.wrapper {
*content*
}
}
}
}
}
body
有 width:100%
和 height:100%
app-block-page
有 width:100%
, height:100%
, background-color: red
和 display:block
app-block-content
有 padding:100px 0
, display:flex
, justify-content:center
和 align-items:center
div.wrapper
有 width:80%
结果
问题
如何让背景颜色不滚动?
我只需要滚动表格。
最佳答案
您应该能够在 app-block-page
上使用 position:fixed
position: fixed; An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.
关于html - 滚动时背景高度全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59468722/