2015-11-26 65 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%重要!}:覆盖重要! ; }也工作。

相关问题