在IE8中拉伸图像作为背景

时间:2013-05-27 19:41:46

标签: html css internet-explorer background

我正在尝试将图像拉伸到IE8中的浏览器边界。除了右边,左边,顶部和底部有大约5px的白色空间外,它正在工作。我希望图像完全适用于所有方面。我的雇主暗示如果我不能正确使用这个页面,这是最后一根稻草:(如果可以,请帮助..

HTML:

</head>
 <body class="fullbackground">
 <!--THIS IS THE BACKGROUND IMAGE--><img class="fullbackground" src="c:\documents and settings\zx08067\Desktop\Outage_Page\background.png">
    <div class="top">
...
...

CSS:

body {
    position:relative;
}

img.fullbackground {
    position:absolute;
    z-index:-1;
    top:0;
    left:0;
    width:100%; /* alternative: right:0; */
    height:100%; /* alternative: bottom:0; */
    padding-left:0px;
    padding-right:0px;
    margin-left:0px;
    margin-right:0px;
}

2 个答案:

答案 0 :(得分:1)

尝试将body标签设置为边距和填充为0。

body {
    position:relative;
    margin: 0;
    padding:0;
}

大多数网络浏览器在元素上都有自己的默认样式。我个人总是使用重置脚本,如: http://meyerweb.com/eric/tools/css/reset/

答案 1 :(得分:0)

在你的CSS添加

html,body{
padding:0 0 0 0;
margin:0 0 0 0;
overflow-x:hidden; // To remove the bottom scrollbar
}

希望它有效。