Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
327 views
in Technique[技术] by (71.8m points)

html - How to create a table cell that scrolls when overflowing

I must create a table cell with a fixed height and width, but with a lot of content; something using overflow: auto. The problem is that I can't use display: block on a table cell (it kind of breaks the table layout) so I tried this:

height: 100px;
overflow: auto;
position: relative;
width: 1280px;

But it's not working. Here is my markup:

        <tr>
            <td colspan="3" style="width: 1280px; overflow:auto;">
                {assign var="latime" value=$agenda|@count}
                {assign var="latime" value=$latime*150}
                <div style="width: 1280px; position: relative; overflow: auto; ">
                    <div style="width: {$latime}px; height: 100px; position:relative;">
                        {assign var="i" value=0}
                        {foreach from=$agenda item=ag}
                            {assign var="img" value=$agenda[$i][3]}
                                &nbsp; &nbsp;<img src="{$img}" id="imag{$i}" onclick='schimbaslidetoti({$i})' />&nbsp; &nbsp;
                            {assign var="i" value=$i+1}     
                        {/foreach}
                    </div>
                </div>
            </td>
        </tr>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can nest a block-level div with the overflow:scroll property set inside the table cell. ie

<td><div style="overflow:scroll;">Content</div></td>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...