2015-11-26 62 views
0

我試圖讓我的網站上BJBGaming1.com背景的背景,我有這個當我試圖讓我的網站上使用CSS背景/ HTML,它不會顯示

<!doctype html> 
<html class="no-js" lang="en"> 
<head> 
<meta charset="utf-8"/> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> 
<title>BJBGaming1</title> 
<link href="css/main.css" rel="stylesheet" type="text/css"> 
<link rel="stylesheet" 
href="http://dhbhdrzi4tiry.cloudfront.net/cdn/sites/foundation.min.css"> 
</head> 
<body> 

,如果你看我有有這樣的代碼

html { 
min-height:100%; 
min-width:100%; 
overflow-x: hidden; 
overflow-y: scroll; 
width: 100%; 
} 
body { 
background-image:url('../img/background.png'); 
background-repeat:no-repeat; 
background-size:cover; 
} 

的CSS/main.css的一部分,我有名字background.png即1個文件夾回至IMG文件夾,以便我有相匹配的圖像。 ./img/background.png,但背景仍然不會顯示,請有人幫忙。

回答

1

你可以嘗試使用!importantbackground-image因爲foundation.css已經覆蓋您的背景圖像#fefefe

html { 
    min-height:100%; 
    min-width:100%; 
    overflow-x: hidden; 
    overflow-y: scroll; 
    width: 100%; 
} 
body { 
    background-image:url('../img/background.png') !important; 
    background-repeat:no-repeat; 
    background-size:cover; 
} 

OR

您也可以加載您的main.css文件的基礎後, .css

<link rel="stylesheet" href="http://dhbhdrzi4tiry.cloudfront.net/cdn/sites/foundation.min.css"> 
<link href="css/main.css" rel="stylesheet" type="text/css"> 
+0

謝謝你,我做了你所說的一切,但它不會覆蓋整個網站。你可以在BJBGaming1.com上看到我的意思 – BJBGaming1

+0

我剛剛做了它,以便它使用像素大小,但是你知道它使它完全適合完美,所以它覆蓋了背景 – BJBGaming1

+0

嘗試添加'background-attachment:fixed;'到身體的CSS並改變'背景大小'爲'100%自動'它應該使你的背景固定並填滿屏幕。 –

0

使用Chrome開發者工具S,我能得到你的形象使用

body { background-image: url('../img/background.png') !important; } 

正文中顯示:;將工作

或身體{背景大小{背景大小的100%重要!}:覆蓋重要! ; }也工作。

相關問題