溢出:滚动;在<td> [英] overflow:scroll; in <td>

查看:20
本文介绍了溢出:滚动;在<td>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 CSS 属性 overflow:scroll; 中不起作用,而 overflow:hidden; 效果很好?

<tr><td style="overflow:scroll; width:50px;">10000000000000000000000000000000000</td><td>200</td><td>300</td></tr>

来自 CSS 规范1,2,我不明白为什么.

解决方案

我得到了一些东西 从这里

<块引用>

Andrew Fedoniouk 写道:

<块引用>

这实际上是我的问题:一个技术原因是溢出属性不适用于表."-为什么?这是什么原因?

我不是专家,但我相信这是只是为了向后兼容旧表行为.你可以检查自动"表格布局规范中的算法我很漂亮确定这个布局算法是与溢出不兼容财产(或更准确地说,布局算法永远不会导致需要任何溢出值除了可见").

<块引用>

是的,这就是我问的原因.好像没有正式的理由为什么或不应该是可滚动的,但看起来像UA 供应商在这方面达成了一些无声的协议.也是如此问题.

规范与您一致到元素.表格单元格是应该尊重溢出,虽然至少,Mozilla 似乎没有这样做所以.我无法回答你的问题这个例子,虽然我仍然会猜测答案仍然与传统渲染.

主线程在这里.>

Why does the CSS property overflow:scroll; not work in <td>, while overflow:hidden; works well?

<table border="1" style="table-layout:fixed; width:100px">
  <tr>
    <td style="overflow:scroll; width:50px;">10000000000000000000000000000000000</td>
    <td>200</td>
    <td>300</td>
  </tr>
</table>

From the CSS specs1,2, I can't see why.

解决方案

I got something from here!

Andrew Fedoniouk wrote:

This is actually my question: "One technical reason is that the overflow property does not apply to tables." - why? What is this reason?

I'm no expert, but I believe this is just for backward compatibility with legacy table behavior. You can check the "automatic" table layout algorithm in the spec. I'm pretty sure that this layout algorithm is incompatible with the overflow property (or, more accurately, the layout algorithm will never result in the need for any value of overflow except 'visible').

Yep, this is why I am asking. Seems like there are no formal reasons why or should not be scrollable but seems like UA vendors reached some silent agreement in this area. So is the question.

The spec agrees with you with respect to elements. Table cells are supposed to respect overflow, although Mozilla, at least, appears not to do so. I can't answer your question in this instance, although I would still guess the answer is still tied to legacy rendering.

The main thread is here.

这篇关于溢出:滚动;在&lt;td&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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