2014-11-21 59 views
1

我想在我的主頁上設置封面圖像。我加入以下代碼cssless文件:css不能使用引導較少

background: url("../images/default-bg2.jpg") repeat scroll 0 0/100% 100% rgba(0, 0, 0, 0) 

但它似乎並沒有工作。

如何設置自適應封面圖片?

注:我使用引導少

回答

1

也許嘗試

background: url(../images/default-bg2.jpg) no-repeat center center fixed; 
-webkit-background-size: cover; 
-moz-background-size: cover; 
-o-background-size: cover; 
background-size: cover; 

更多信息 http://css-tricks.com/perfect-full-page-background-image/

+0

當我在瀏覽器上滾動時,圖像也在Internet Explorer上滾動。我不想這個滾動圖像 – 2014-11-21 05:44:43

+0

如果我的問題得到了解決......這將是解決方案 background-attachment:fixed;它的工作原理是 – 2014-11-21 05:53:45

+0

。我只是將背景'固定'改爲'滾動' – 2014-11-21 06:10:05

0

加入"background-size:cover;"到CSS應該工作。

請試試這個:

背景:網址( 「youimage.png」)固定不重複中心中心;

-webkit-background-size:100%auto;

-moz-background-size:100%auto;

-o-background-size:100%auto;

background-size:100%auto;

+0

這是行不通的。 – 2014-11-21 05:41:47

0
background: url("../images/default-bg2.jpg") repeat scroll; 
background-position:100% 100%; 

請試試這個。