전체 웹 사이트를 둘러싼 경계를 만드는 현명한 방법을 찾고 있습니다.전체 웹 사이트의 테두리
문제는 내가 속성 width: 100%
와 height: 100%
와 뷰포트 전체에 걸쳐 스트레칭해야 배경으로 DIV .teaser-image
를 해결 한 것을, 그래서 그렇지 않으면 고정 사업부가 아니라,이 값에도 html
과 body
을 설정해야 그것의 내용만큼 높다.
테두리를 body
에 추가하면 높이가 100 %로만 감싸지 만 전체 사이트는 늘어나지 않습니다.
이 아이디어를 해결하는 방법은 무엇입니까?
HTML
<div class="teaser-image"></div>
<header>
<h1>Headline</h1>
<p>Some content</p>
</header>
<section>
<h1>Headline</h1>
<p>Some content</p>
</section>
<section>
<h1>Headline</h1>
<p>Some content</p>
</section>
CSS
html,
body {
margin: 0;
height: 100%;
color: #fff;
}
body {
border: 10px solid #000;
}
.teaser-image {
position: fixed;
z-index: -1;
width: 100%;
height: 100%;
background: url(http://www.joomlaworks.net/images/demos/galleries/abstract/7.jpg) center center no-repeat;
background-size: cover;
}
header,
section {
width: 100%;
min-height: 100%;
padding: 20px;
box-sizing: border-box;
}
section {
background: rgba(255, 255, 255, .5);
}