日期:2014-05-17  浏览次数:20645 次

求css基础问题!
怎样在css中将背景图片填满真个页面,并且在滑动的时候使得图片不动,只有内容动的啊?谢谢!

------解决方案--------------------
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<style type="text/css">
body {
    background-image:url(http://avatar.profile.csdn.net/E/C/F/2_t5500.jpg);
    background-repeat: repeat;
    background-attachment:fixed;
}
</style>
<div style="height:10000px;">TEST</div>
</body>
</html>

------解决方案--------------------
缩写方式:
CSS code
body {
    background:url(http://avatar.profile.csdn.net/E/C/F/2_t5500.jpg) repeat fixed;
}

------解决方案--------------------
background-attachment:fixed;