css怎么让网页各屏背景全屏显示

html-css020

css怎么让网页各屏背景全屏显示,第1张

css让网页各屏背景全屏显示,首先需要理解就是浏览器展示区域,其实就是body这个部分,想要让背景全屏的话,需要用到css的background这个属性,在选择好背景的图片就可以了,具体看下代码:

<html>

<head>

<style>

body{

background:url('图片地址')repeat 0px 0px

}

</style>

</head>

<body>

<p>我是测试文字</p>

</body>

</html>

background: url(ab.gif) repeat //背景为ab.gif,横向、纵向平铺

① 如果是做网站的水印背景,可以放到body里,

② 如果是做页面的背景,放到最外层的div里,

比如:

① body{background: url(ab.gif) repeatmargin:0px auto}

② .box{background: url(ab.gif) repeatmargin:0px auto}

单纯横向平铺:repeat-x

单纯纵向平铺:repeat-y

不平铺:no-repeat