问题描述
如题,在给body添加一个背景图时
用到了如下代码
body {
background: url(./images/bg.jpg) no-repeat top center;
}
发现设置无效
问题解决
html {
height: 100%;
}
body {
height: 100%;
background: url(./images/bg.jpg) no-repeat top center;
}
出现原因
因为是对照视频写的,视频里的代码
html {
height: 100%;
}
body {
height: 100%;
}
人家是写在一个单独的reset.css文件里,就导致出现了这个问题,
问题简单,但也耗费了不少时间找原因和解决,特此记录