2017-10-10 16 views
-1

height: 100%;でdivを作成しようとしましたが、背景が固定されている必要があります。overflow-yが固定位置で動作していない

box-sizing:border-box;私のような似たような質問で誰かのように答えるようにしましたが、これは私にとっては効果がありません。また、私は絶対位置を使用しようとしましたが、それでも同じです。ここで

は私のcss

.backgroundIdKlupa { 
position:fixed; 
padding: 0; 
z-index: 999999; 
margin-bottom: 45px; 
} 
.backgroundIdKlupa_tablica { 
background-color: grey; 
top: 0; 
bottom:0; 
position:fixed; 
overflow-y:scroll; 
overflow-x:hidden; 
} 
.idKlupa_tablica { 
height: 90%; 
font-size: 14px; 
font-weight: bold; 
margin-bottom: 45px; 
} 
.backgroundIda { 
background-color: green; 
width: 100%; 
height: 550px; 
} 

Htmlの

<div class="backgroundIdKlupa col-lg-1 col-md-1 col-sm-2 col-xs-12"> 
      <table class="backgroundIdKlupa_tablica table-hover"> 
       <thead> 
        <tr> 
         <th class="backgroundIdKlupa_izbornik_th">Bench ID</th> 
        </tr> 
       </thead> 
       <tbody> 
        <tr> 
        <td class="aktivniItem backgroundIdKlupa_izbornik_td" >123</td> 
        </tr> 
        <tr> 
        <td class="aktivniItem backgroundIdKlupa_izbornik_td" >123</td> 
        </tr> 
        <tr> 
        <td class="aktivniItem backgroundIdKlupa_izbornik_td" >123</td> 
        </tr> 
       </tbody> 
      </table> 
     </div> 
     <div class="backgroundIda col-lg-1 col-md-1 col-sm-2 col-xs-12"></div> 

左側のメニューを修正する必要がありますが、より多くの項目がある場合、オーバーフロー-Yを持っている必要がありますされています。自動

右を内容(緑)は定期的です。 Thnx

答えて

1
For add scroll in any element you need to add height or max-height. second this is a table so make it a block element by using display:block 

backgroundIdKlupa_tablica { 
    background-color: grey; 
    top: 0; 
    bottom: 0; 
    position: fixed; 
    overflow-y: scroll; 
    overflow-x: hidden; 
    height: 50px; 
    display: block; 
} 
+0

あなたはAnkit Awasthiです。この作品は、高さのために私は高さを追加する必要があります:100%; %は機能しません。 – Arter

+1

。バックグラウンドIDKlupa_tablica { \t \t \t \t背景色:グレー; \t \t \t \t top:0; \t \t \t \t bottom:0; \t \t \t \t位置:固定; \t \t \t \t overflow-y:auto; \t \t \t \t overflow-x:hidden; \t \t \t \t高さ:100%; \t \t \t \t display:block; \t \t \t \t}私のために働くここでは、テーブルに十分な行を追加するだけです –

関連する問題