2011-10-30 27 views
1

我怎样才能用一个大的图像填充整个背景?这张照片是1400 * 867,解决方案here它填满了宽度,但没有填充高度。我不在乎照片是否为了填满身高而裁剪。使用CSS/jquery或Flash制作完整图像背景?

CSS3的方式(背景大小)是完美的,但在IE中不起作用。

如果你不知道使用css/jquery的方法,你能指示我一个flash脚本,我可以只输入图像的路径并让flash调整它的大小?

谢谢!

回答

1

看看这个jQuery插件:

http://nanotux.com/blog/fullscreen/

我认为这是你在找什么;我希望它有帮助!

+0

非常感谢,会检查出来,让你知道它是怎么回事。 :D – Cris

+0

这工作很好。谢谢你为我节省了很多时间! – Cris

1

试试这个:

HTML:

<div id="wrapper"> 

    <!--bg-img--> 
    <div class="bg-img> 

     <img src="images/bg.jpg"/> 

    </div> 
    <!--bg-img--> 

</div> 

CSS:

.bg-img{ 
    /*--sets rules to fill browser window in width and height--*/ 
    min-height: 100%; 
    min-width: 1024px; 

    /*--sets proportionate scaling--*/ 
    width: 100%; 
    height: auto; 

    /*--positioning and layering of image container--*/ 
    position: fixed; 
    top: 0; 
    left: 0; 
    z-index:-5; 
} 

我相信CSS3方法你讲的是这样的?:

.bg-img{ 
    background: url(images/bg.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

那么,有IE浏览器周围的工作,你可以尝试,但它不是万无一失。你可以尝试改变整个片段来代替:

.bg-img{ 
    /*--CSS3 compatible browsers setup--*/ 
    background: url(images/bg.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 

    /*--work around for IE--*/ 
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='.bg.jpg', sizingMethod='scale'); 
    -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='bg.jpg', sizingMethod='scale')"; 
} 

祝你好运!希望它有效!