内容增长时如何阻止表格调整大小? [英] How to stop table from resizing when contents grow?

查看:133
本文介绍了内容增长时如何阻止表格调整大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个,其中的单元格填充图片。我想让图片变大时,你悬停在他们,我希望表的单元格保持在相同的大小。

I have a table, the cells of which are filled with pictures. I would like the pictures to grow larger when you hover over them and I would like the cells of the table to remain at the same size.

img 样式更改为 position:relative 不工作。更改为 position:absolute 可以工作,但我不知道图像的绝对位置。

Changing the img style to position:relative doesn't work. Changing it to position:absolute does work, but I don't know the absolute position of the images.

使用CSS有这个问题的优雅解决方案吗?我宁愿不使用任何JavaScript。

Is there an elegant solution to this problem using CSS? I'd rather not use any JavaScript.

推荐答案

使用 style =table-layout:fixed;但这将使文本或图像与其他列重叠,以防万一超过宽度。请确保不要在空白处放置较长的短语。

Use style="table-layout:fixed;", but this will make text or images overlap with other columns in case it exceed the width. Make sure not to place long text phrases without spaces.

这篇关于内容增长时如何阻止表格调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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