CSS代码:
/* 将页面的html和body元素的高度设置为100% */ html, body { height: 100%; }
/* 创建一个装载背景图的div,将其设置为正好覆盖所有页面 */ .bg-image { position: fixed; top: 0; bottom: 0; left: 0; right: 0; z-index: -1;
/* 设定背景图的属性 */ background-image: url('background-image.jpg'); background-repeat: no-repeat; background-size: cover; background-position: center center; }
/* 创建一个将内容包裹在内的div / .content-wrap { / 设置该div的高度,并将其定位到距离顶部100px的位置 */ height: 100%; margin-top: 100px; padding: 20px; }
HTML代码:
上一篇:部分缺失的XML标签修复
下一篇:不分区怎么安装ubuntu