wrapper
div에 높이가없는 이유는 무엇입니까? 높이 (height:200px
)를 설정하면 녹색 배경이 나타나지만 자동 높이로 설정하는 방법은 무엇입니까? 여기 Div에 높이가 없음
HTML :
<div class="wrapper">
<div class="effect"></div>
<div class="content">
...content
</div>
</div>
CSS : 그것은 작동하지 않습니다
.content {
position: absolute;
background-color:red;
}
.wrapper, .effect {
background: green;
}
.wrapper {
position: relative;
width: 630px;
}
.effect {
width:100%;
position: absolute;
}
높이 : 자동; ..... –
http://jsfiddle.net/q3xT4/2/ 나는 그것을 시험해 보았지만 나에게 효과가 없다. – szu
요소를 위치 시키면 정상적인 문서 흐름에서 절대적으로 제거된다. 그러므로'.content'도'.effect'도'.wrapper'를 확장하지 않습니다. – showdev