2016-10-20 9 views
1

私は100%の高さを持つポップアップdivを持っています。未知の高さから垂直スクロール可能divを作成する

.popup{ 
height:100%; 
} 

私は先に行って、60%のマージントップ

.popup{ 
margin-top:60%; 
} 

とこれだけ40%スペースのポップアップの下端に提供されていますを作成しました。

40%ボトムスペースでは、おそらく500pxのスクロール可能なdivコンテナが必要です。これは機能せず、40%スペースしか使用できず、スクロールバーが表示されません。

500pxさんは40%スペースにどのように配置できますか?

+0

HTMLと任意のフィドルも –

+0

私は排他的にポップアップクラスと下半分のdiv要素で働いているあなたの試みるコード –

+0

を提供します。 .popup {margin-top:60%;} .bottomhalfdiv {height:500px;} ' –

答えて

1

チェックこのスニペット:

body, 
 
html, 
 
.outer { 
 
    width: 100%; 
 
    height: 100%; 
 
} 
 
.wrapper-top, .wrapper-bottom { 
 
    position: relative; 
 
    width: 400px; 
 
    top: 0; 
 
    bottom: 0; 
 
    border: 1px solid #555; 
 
} 
 
.wrapper-top { 
 
    height: 60%; 
 
} 
 
.wrapper-bottom { 
 
    height: 40%; 
 
} 
 
.inner { 
 
    position: absolute; 
 
    width: 100%; 
 
    top: 0px; 
 
    bottom: 0px; 
 
    overflow-y: auto; 
 
}
<div class="outer"> 
 
<div class="wrapper-top"> 
 
    <div class="inner"> 
 
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
    </div> 
 
</div> 
 
<div class="wrapper-bottom"> 
 
    <div class="inner"> 
 
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
    </div> 
 
</div> 
 
</div>

0

このフィドルを確認してください:https://jsfiddle.net/vadimb/wx2v7pj6/

.popup { 
    margin-top: 60%; 
    background-color: red; 
    height: 250px; 
    overflow: hidden; 
} 

.inner { 
    overflow-y: scroll; 
    height: 250px; 
} 

とHTML

<div class="popup"> 
<div class="inner"> 
abcd<br/>.... 
</div> 
</div> 
1

.main{ 
 
    width:100%; 
 
    height:350px; 
 
    border:1px solid; 
 
} 
 
.top{ 
 
    width:100%; 
 
    height:60%; 
 
    border:1px solid red; 
 
} 
 
.bottom{ 
 
    display:inline-block; 
 
    width:100%; 
 
    height:38%; 
 
    border:1px solid #ff6600; 
 
    padding:5px; 
 
    overflow:auto; 
 
} 
 
.content{ 
 
    width:100%; 
 
    height:500px; 
 
    border:1px solid blue; 
 
}
<div class="main"> 
 
<div class="top"></div> 
 
    <div class="bottom"> 
 
    <div class="content"></div> 
 
    </div> 
 
</div>

+0

K一度試してみると、高さが40%、内容に500pxの高さがあります。 –

関連する問題