2017-03-22 1 views
0

에는 구문 오류를 찾을 수없는 경우에도, 작동하지 않는이, 여기 내 HTML입니다 : -불투명도 내가 이렇게하는 매체 불투명하지만,없는과 배경 그림을 넣어하려고

  
 
<body style="margin:auto;width:100%;height:100%;opacity:0.1;background-image:url('http://farm3.static.flickr.com/2098/2260149771_00cb406fd6_o.jpg')"> 
 
</body>

+0

스 니펫 – user3386779

+0

을 어떻게 만드나요? 나는 여기에서 새로운 것이다 –

+0

[CSS : 불투명도가있는 배경 이미지를 설정하겠습니까?] 가능한 복제본 (http://stackoverflow.com/questions/4183948/css-set-background-image-with-opacity) –

답변

0

대신 body elemet을 조정하고 CSS를 사용하여 스타일을 구분하는 것이 좋습니다.

#background { 
 
    position: fixed; 
 
    top: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    height: 100%; 
 
    background-image: url('http://i40.tinypic.com/3531bba.jpg'); 
 
    background-repeat: no-repeat; 
 
    background-attachment: fixed; 
 
    background-size: 100%; 
 
    opacity: 0.4; 
 
}
<!DOCTYPE html> 
 

 
<head> 
 
    <title>Your favourite travle partner</title> 
 
</head> 
 

 
<body> 
 
    <div id="background"></div> 
 
</body>

1

사용 DIV 대신 body 태그. 그리고 그 div에 특별한 높이를주십시오.

<!DOCTYPE html> 
     <head> 
     <title>Your favourite travle partner</title> 
     </head> 

     <body> 
      <div style="margin:auto;width:100%;height:400px;opacity:0.1;background-image:url('http://www.menucool.com/slider/jsImgSlider/images/image-slider-2.jpg')"> 

    </div> 
     </body> 

     </html>`