带有表格布局的表格:固定和调整大小 IE8 与 IE 7 / Chrome
我正在 html 中制作时间线视图,但遇到了以下问题:
我有一个包含 12 个单元格的表格行,代表 12 个月,每个月都有一个根据该月天数的 colspan。在同一个表中还有另一行包含天数,因此它包含 365 个单元格。表格宽度为 100%,表格布局是固定的。当我在 Internet Explorer 8 中调整表格大小时,月份单元格的大小似乎均等地调整,但是当我在 Internet Explorer 7 或 Chrome 中调整大小时,调整大小从前几个月开始。这导致了几个月较短的错觉
我有一个屏幕截图来说明问题,您可以看到八月到一月的月份比其余月份要小:
Jsfiddle 示例: http://jsfiddle.net/GZtrx/
我有办法在不使用 Javascript 的情况下解决这个问题吗?
I'm making a timeline view in html but I ran into the following problem:
I've got a table row with 12 cells that represent 12 months, each of the month has a colspan according to the number of days in that month. In the same table there is another row containing days, so it contains 365 cells. The table has a width of 100% and the table layout is fixed. When I resize the table in Internet Explore 8 the month cells all seem to resize equally, however when I resize in Internet Explorer 7 or Chrome, the resizing starts at the first months. Which causes the illusion the months are shorter
I've a screenshot to illustrate the problem, you can see the months august till January are smaller then the rest:
Jsfiddle example: http://jsfiddle.net/GZtrx/
I there anyway to fix this without using Javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试这样的操作: JsFiddle 示例 它使用固定的 % 宽度而不是 colspan。
You could try something like this: JsFiddle example which uses a fixed % width instead of colspan.
一些想法:
是否采用传统方法并使用透明的 1x1 px gif,并使用 .CSS 来设置 gif 宽度的样式?
作为单元格背景的透明 gif。
.CSS 中的最小宽度
A few thoughts:
How about going old school and using a transparent 1x1 px gif, and using .CSS to style the width of the gif?
Transparent gif as a cell bg.
min-width in the .CSS