HTML设置背景图片填满整个页面

  • 在标签里添加文件路径,语法如下:

这时,页面虽然充满了背景,但被填充了多次。

  • 在里添加样式,代码如下:

background="${pageContext.request.contextPath }/statics/img/ball.gif" style=" background-repeat:no-repeat ; background-size:100% 100%;background-attachment: fixed;"

你看,背景就充满页面了。

  • 图片自适应窗口大小:background-size:contain或background-size:100% 100%;

你可能感兴趣的:(html,css,html5)