그래서 100vh 인 웹 사이트에 영웅 이미지를 사용하고 있습니다. 이제 이미지가 절대적으로 배치되므로 로고, 탐색 및 텍스트와 같은 다른 요소를 상대적으로 배치 할 수 있습니다. 이 섹션을 끝내고 새 이미지 및 기타 텍스트로 새 섹션을 시작하고 싶지만 일단 새로운 행, 열을 시작하고 h1 텍스트로 새 이미지를 넣으려고하면 이전 이미지 뒤에 숨어 있습니다. 나가 의미하는 것은 새로운 심상을 가진 새로운 단면도를 원하고 영웅 심상의 밑에 나타나는 <h1>
원본은 그것을 은폐하거나 숨기고 있기 때문에 그것의 밑에 그것을 숨기지 않는다는 것을이다. 부유물이 아니거나 뭐니 뭐니해도 내 수레가 개간되어서 왜 이런 일이 일어나지 않는지 알 수 없습니다.HTML 요소가 겹치다
여기에 약간의 코드 푼이 있으므로 무엇을 배웠는지 이해하게 될 것입니다.
<div class="container-fluid clearfix">
<div class="row">
<div class="col-lg-12">
<div class="hero_img">
<img class="logo" src="assets/logo.png"></img>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".collapse">
☰
</button>
<div class="collapse">
<div class="col-xs-12">
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="#">Lorem</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Lorem</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Lorem</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Lorem</a>
</li>
</ul>
</div>
</div>
<div class="black_box clearfix"><h1>Kolding Bike Marathon</h1></div>
<div class="black_box_sub clearfix"><p>Bring activity to your life again</p></div>
<button type="button" class="btn btn-outline-secondary">Register now</button>
<button type="button" class="btn btn-success">Learn more</button>
</div>
</div>
</div>
</div>
</div>
<div class="section_one">
<h1>heyyyyy</h1>
</div>
.hero_img {
background-image: url("assets/hero.jpg");
width: auto;
height: 100vh;
background-size: cover;
position: absolute;
top: 0;
left: 0;
z-index: 999;
overflow: hidden;
clear: both;
}
.hero_img {
width: 100%;
height: 100vh;
position: absolute;
top: 0;
}
.logo {
position: relative;
left: 20px;
top: 20px;
z-index: 1002;
width: 5%;
min-width: 50px;
}
.nav {
position: relative;
top: 0;
z-index: 1000;
margin-top: 20px;
/*margin-right: 15px;*/
padding: 20px;
/*float: right;*/
width: auto;
flex-direction: column;
background: #555;
/*width: 100%;*/
filter: opacity(0.93);
}
a {
text-decoration: none;
color: white;
display: block;
border-bottom: 1px solid #444;
}
a:hover {
color: #999;
}
.nav-item {
display: block;
}
.navbar-toggler {
/*float: right;*/
display: flex;
justify-content: right;
position: relative;
z-index: 1000;
margin-top: 15px;
margin-right: 15px;
color: white;
float: right;
}
.black_box {
position: relative;
width: 45%;
min-width: 400px;
text-align: center;
z-index: 1000;
background: black;
margin-top: 10%;
padding: 10px 30px;
clear: both;
}
.black_box h1 {
color: white;
/*font-family: 'PT Sans', sans-serif;*/
font-family: 'Montserrat', sans-serif;
font-weight: 600;
letter-spacing: 1.5px;
}
.black_box_sub {
position: relative;
width: 30%;
min-width: 310px;
text-align: center;
z-index: 1001;
background: black;
margin-top: 2%;
clear: both;
margin-left: 90px;
}
.black_box_sub p {
color: white;
padding: 5px 25px;
font-family: 'Montserrat', sans-serif;
text-transform: uppercase;
padding-top: 10px;
padding-bottom: 0px;
}
Codepen : http://codepen.io/Limpuls/pen/NpbwYp
나는 당신이 묻고있는 것을 얻지 못했고, 조금 더 자세히 설명 할 수 있습니까? 어쩌면 그림이 무엇인지 지금 무엇이고 정확히 무엇을 원하니? –
나는 "vh"측정에 지나치게 익숙하지 않지만 이것이 당신의 문제와 관련이 있다고 생각합니다. 이미지를 세로보기 높이의 100 %로 설정하면 콘텐츠 아래에 콘텐츠를 배치 할 수 없습니다. 그럼에도 불구하고 자바 스크립트를 사용하여 창의 높이를 얻은 다음 이미지 div에 적용하여 픽셀 단위의 정확한 높이가되도록 할 수 있습니다. div를 쌓아두면 아무런 문제가 없습니다. 실제로 절대 div 레이어에 동일한 숫자를 적용하면 모두 깔끔하게 스택됩니다. –
명확하지 않은 설명이있어 죄송합니다. 이미 해결 했어. Vh 측정 단위는 이와 관련이 없습니다. 나는 내 영웅 이미지 위치를 절대적으로 제공함으로써 실수를했다. 상대적 위치에 있어야하고 내부에있는 모든 요소는 상대적으로 위치해야합니다. 이제 속성 바카라를 변경 했으므로 주 영웅 이미지 아래에 새 콘텐츠가 중복되지 않는 것을 볼 수 있습니다. 어쨌든 고마워! – Limpuls