2017-04-19 4 views
0

이 배경 이미지를 나머지 페이지와 함께 스크롤하려면 어떻게해야합니까? (배경 - 첨부 : 스크롤, 작동하지 않습니다.) 스크롤하기 전에 배경 이미지와 로고를 머물고 싶을 때 위치 시켰지만 스크롤 할 때 로고와 제목 스크롤은 있지만 탐색 표시 줄과 배경 이미지는 그렇지 않습니다.CSS 배경 이미지 스크롤

.content { 
    overflow: auto; 
    position: relative; 
    } 
.content:before { 
    content: ""; 
    position: fixed; 
    left: 0; 
    right: 0; 
    top:-175px; 
    z-index: -1; 

    display: block; 
    background-image: url("/assets/backgroundpic.jpg"); 
    background-size:cover; 
    background-position:center top; 

    width: 100%; 
    height: 500px; 
} 



<div class="container content text-center" style="position:relative;"> 
    <%= image_tag("/assets/logo-seal.png", size: "250x250", class: "img-responsive img-circle margin", style: "display:inline;margin-top:200px;") %> 
    <h1 style="font: 48px Oswald, sans-serif;">TITLE</h1> 
</div> 

답변

0

이 배경 이미지가 position: fixed;이있는 요소에 할당 된 쉬운 방법입니다. 요소가 스크롤되지 않기 때문에 (고정되어 있음) 배경은 보이지 않습니다.

해당 요소를 수정하지 않고 해결책을 찾아야합니다.

+0

고맙습니다! 나는 위치를 절대로 변경하고 콘텐트 바깥의 div에 콘텐트 클래스를 두었다. 나는 내가 전에 어떻게 생각하지 않았는지 모르겠다. – Xenedra