问题描述
在 iPad 上呈现 html 页面时,我遇到了 CSS 问题.在其他浏览器中一切正常.问题是我的表格中的单元格之间有一个小空间,如图所示:http://oi53.tinypic.com/2vl0as9.jpg
I have a CSS problem when the html page is rendered on iPad. Everything works good in other browsers. The problem is that I get a small space between the cells in my tables as you can see in the picture: http://oi53.tinypic.com/2vl0as9.jpg
如果我在单元格之间的线上放大页面最大值,它就会消失..所以当页面呈现时它一定是某种错误.我可以以某种方式解决这个问题吗?这是我的表格和 CSS:
If I zoom in the page maximum on the line between the cells, it dissappears.. So it must be some kind of bug when the page is rendered. Can I go around this in some way? This is my table and CSS:
<table class="smallTable" cellpadding=0 cellspacing=0>
<tr>
<td class="td1"></td>
<td class="td2"></td>
</tr>
<tr>
<td class="td1"></td>
<td class="td2"></td>
</tr>
</table>
CSS:
.smallTable
{
margin: 20px auto 40px auto;
border-spacing: 0;
}
.smallTable td
{
margin: 0;
}
.smallTable td.td1
{
background: url(../images/table1.png);
}
.smallTable td.td2
{
background: url(../images/table2.png);
}
推荐答案
在尝试制作 HTML 格式的电子邮件时,我只用了半天时间来解决这个错误.
I just bashed my head against this bug for half a day while trying to make an HTML formatted email.
iPad 在以非 1:1 比例查看表格时出现错误(喘气!).如果您的表的 TD 标签具有深色背景并且 TABLE 的父标签具有浅色,则这一点尤其明显.Rowspans 和 colspans 放大了这个问题.
iPad's have a bug (gasp!) when viewing tables at a non 1:1 scale. This is especially apparent if your table's TD tags have a dark background and the TABLE's parent has a light color. Rowspans and colspans amplify the problem.
我最初认为问题在于 iPad 引入了边框.
真正的问题是,Apple 的编码人员并没有决定在缩放时是否要统一向上或向下舍入像素的一小部分.
I initially thought the problem was that iPad was introducing a border.
The real problem is that the coders at Apple didn't decide if they were going to uniformly round fractions of a pixel up, or down while scaling.
因此,某些 TD 标签在非 100% 比例时似乎有边框.在现实中,它只是透出浅色背景.
Hence, some TD tags appear to have a border when not at 100% scale. When in reality it is just the light background showing through.
解决方案是将表格包裹到另一个具有相同深色背景的表格中.
The solution is to wrap the table into another table that has the same dark background.
欢迎来到 1998 网页设计.我听说 mp3.com 风靡一时.我要从pets.com 给我买一些邮购狗粮.
Welcome to 1998 web-design. I hear mp3.com is all the rage. Gonna buy me some mail-order dog treats from pets.com.
感谢 iPad.
这篇关于iPad 上带有表格边框的 CSS 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!