html - 滚动时背景高度全屏

标签 html css scroll background-color

我有以下嵌套:

body {
    app-root {
        app-block-page {
            app-block-content {
                div.wrapper {
                    *content*
                }
            }
        }
     }
}

bodywidth:100%height:100%

app-block-pagewidth:100%, height:100%, background-color: reddisplay:block

app-block-contentpadding:100px 0, display:flex, justify-content:centeralign-items:center

div.wrapperwidth:80%

结果

enter image description here

问题

如何让背景颜色不滚动?

我只需要滚动表格。

最佳答案

您应该能够在 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.

来源:https://www.w3schools.com/css/css_positioning.asp

关于html - 滚动时背景高度全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59468722/

相关文章:

jQuery - 菜单滚动项效果示例 - 它叫什么?

javascript - 如何删除文本选择中的子元素

javascript - 什么时候应该使用 html 中的表单

javascript - 如何使我的 div 居中并使它们与媒体查询堆叠

html - CSS:加载 SVG 和相对于其元素的位置

html - 如何使用前/后元素切片背景颜色

html - 如何在html表格上显示滚动条

html - 使用 iFrame 嵌入

html - 我可以将文本背景设置为在图像上模糊吗?

javascript - 用于用户协议(protocol) View 、检测启用按钮的 AngularJS 指令在移动 safari 上不起作用