如何创建一个表单元格,当溢出时滚动 [英] How to create a table cell that scrolls when overflowing

查看:118
本文介绍了如何创建一个表单元格,当溢出时滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须创建一个具有固定高度和宽度,但具有大量内容的表格单元格;使用 overflow:auto 的东西。问题是我不能在表格单元格上使用 display:block (这样会破坏表格布局),所以我试过这样:

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>


推荐答案

:在表单元格内设置scroll属性。即

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>

这篇关于如何创建一个表单元格,当溢出时滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆