如何在正文后面的页边距和页面顶部添加背景图像?(Html,css)



我正在构建一个网页,我正在尝试在容器后面的左侧,右侧和顶部的边距中添加一个图像。

我当前网页的最接近的例子在这个演示中找到:https://html5up.net/phantom。

我希望添加类似于此图像中的蓝色的背景图像:https://i.stack.imgur.com/NHbqU.png

所以我希望图像位于浮动页面后面。

好吧,为body添加背景图像,并向内容容器添加background: white(或您想要的任何颜色(,以避免正文背景"闪耀"。

以下代码是您要查找的吗? 如果是这样,本质上它是"边框"的背景颜色,上面的元素具有边距。

body {
background-color: dodgerblue;
}
#content {
position: fixed;
background-color: #fff;
border-radius: 15px;
padding-top: 15px;
text-align:center;

height: 100%;
width: 88%;
margin: 25px;
}
<body>
<div id="content">
<h1>Wow!!</h1>
</div>
</body>

最新更新