如何使外部div增长或眨眼到内部div的大小

时间:2022-09-05 21:26:48

I have an outer div and three inner divs each div is viewed separately and when each div is viewed i want the outer div's height to grow or shrink accordingly.

我有一个外部div和三个内部div,每个div都是单独查看的,当查看每个div时,我希望外部div的高度相应地增大或缩小。

I wish to have tables inside each div which will expand dynamically this means they will not all be the same size, and I would like the outer div to match the size of the inner divs , thanks in advance

我希望在每个div中都有表格,它们将动态扩展,这意味着它们不会都是相同的大小,我希望外部div与内部div的大小相匹配,在此先感谢

HTML

HTML

<div id="scroll-view">
    <div id="scroll-items">
        <div class="view"></div>
        <div class="view"></div>
        <div class="view"></div>
    </div>
</div>
<button id="previous">Previous</button>
<button id="next">Next</button>

CSS

CSS

.view { width: 300px; height: 300px; float:left; }
#scroll-view {
    width: 300px;
    height: 50px;

    overflow:hidden;
    position:relative;
}

#scroll-items { width: 10000px; max-height: auto;  overflow:auto; position: absolute ; }

1 个解决方案

#1


0  

I don't actually understand the effect you're trying to achieve, it'd help if you could reword the question.

我实际上并不理解你想要达到的效果,如果你可以改写这个问题,它会有所帮助。

Having said that, is this close to what you want? http://jsfiddle.net/72deF/

话虽如此,这是否接近你想要的? http://jsfiddle.net/72deF/

#1


0  

I don't actually understand the effect you're trying to achieve, it'd help if you could reword the question.

我实际上并不理解你想要达到的效果,如果你可以改写这个问题,它会有所帮助。

Having said that, is this close to what you want? http://jsfiddle.net/72deF/

话虽如此,这是否接近你想要的? http://jsfiddle.net/72deF/