2013-11-04 2 views
-2

간단한 배경 이미지로로드하려고하는데,로드하려고 애쓰는 것이 힘듭니다. 누구나 내가 뭘 잘못하고 있는지 볼 수 있습니까?배경 이미지가 작동하지 않을 수 있습니다.

HTML

<!DOCTYPE html> 
<html> 
<head> 

    <title>TEST</title> 
    <link rel="stylesheet" type="text/css" href="css/style.css"> 
    <link rel="stylesheet" type="text/css" href="css/normalize.css"> 


</head> 

<body> 

<h1>Hello World</h1> 


</body> 
</html> 

CSS

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

는 CSS에서 위에 언급 한 바와 같이 배경 이미지 이미지/bg.png의 디렉토리에 있습니다.

+0

입니까? 그렇지 않으면 youl은'url ('../ images/bg.png')'또는 CSS 폴더의 상대 참조가 무엇이든간에해야하기 때문입니다. – PlantTheIdea

+0

이것은 정확히 문제가되었습니다! 고맙습니다! – user2810581

+0

나에게 잘 어울린다. http://jsfiddle.net/DFS7c/1/ – Liam

답변

0

참조가 아닌 페이지 위치, 당신의 CSS 디렉토리에 상대적이어야합니다 : 이미지 폴더가 CSS 폴더와 트리에서 동일한 깊이라고 가정

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

이 당신을 위해 작동합니다.

-2

이미지가 어디에 있느냐에 따라 입력 할 때 찾아보기 선택 팝업이 나타나고 컴퓨터에서 이미지를 검색 할 수 있습니다. 그렇지 않으면 당신은 예를 이 복사 할 수 있습니다 :

당신의 CSS 디렉토리가`images`도

enter image description here

관련 문제