2017-11-02 5 views
1

に水平方向にスクロールしません:divが、私は次のようしているオーバーフロー

.container { 
 
    width: 100%; 
 
    height: 100%; 
 
    position: relative; 
 
} 
 

 
.contents { 
 
    position: absolute; 
 
    float: right; 
 
    bottom: 0; 
 
    width: 100%; 
 
    top: calc(100% - 37px); 
 
    overflow-x: auto; 
 
    overflow-y: hidden; 
 
}
<div class='container'> 
 
    <div class='contents'> 
 
    The contents of the 'contents' div might vary its width, not its height 
 
    </div> 
 
</div>

contentsた場合のdivオーバーフローは、水平スクロールは表示されません。垂直スクロールはまだそこに隠されていますが、そこには、このdivがスクロールするもの、まさに水平ではなく垂直です。私はここで何が欠けていますか?

答えて

1

あなたの例を変更しました。

表示ブロックでは、子は親よりも大きくする必要があります。 絶対的な位置は不明ですが、ここでは必要ないようです。すべての

.container { 
 
    width:530px; 
 
    height:210px; 
 
    border: 13px solid #bed5cd; 
 
    overflow-x: scroll; 
 
    overflow-y: hidden; 
 
} 
 

 
.contents { 
 
    display: inline-block; 
 
    float:left; 
 
    height:120px; 
 
    width: 1000px; 
 
    display: block; 
 
}
<div class='container'> 
 
    <div class='contents'> 
 
     The contents of the 'contents' div might vary its width, not its height 
 
     The contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' di 
 
     s' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents ofs' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents ofs' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents ofs' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents ofs' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents ofv might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its heightThe contents of the 'contents' div might vary its width, not its height 
 
    </div> 
 
</div>

+0

を、それが問題を解決していませんが、それは私に手掛かりを与えて...ありがとう! – assembler

0

まず:幅にパーセンテージを使用して、コンテナの場合、体とhtmlに、親へのdivサイズは相対ます。コンテナのdivがscrollabeすることが

、あなたがそのような何かしなければならない。うまく

body { 
    min-width: 120%; 
} 
関連する問題