[英]Scrolling the parent div with respect to the child div horizontal scroll
我有以下HTML代碼:
<div style="height: auto; width: 400px; overflow: hidden;" id= "parent">
//dynamic content which makes width of the parent to overflow
<div style= "height: 200; width: 400px; overflow: auto;" id= "child">
// dynamic content which makes width of the child div to overflow horizontally and vertically
</div>
</div>
有什么辦法可以在滾動子div時水平滾動父div? 實際上,我正在嘗試凍結標題(父div的內容),並希望滾動顯示數據(子div的內容)。 任何幫助將不勝感激。
謝謝
有一個CSS white-space:nowrap
屬性可能起作用。
您可能會遇到的一個問題是,默認情況下,大多數HTML文本都會自動換行。 您可能需要使用<pre>
或<code>
標記來獲取父div
內的水平滾動,而無需換行符(如果要查找的話)。
要獲得凍結窗格的效果,您的評論說您正在尋找,只需對標題和內容窗格使用單獨的div。
<div id="container">
<div id="header"></div>
<div id="info"></div>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.