简体   繁体   English

使用border-radius时,IE / Edge中的单元格之间出现毛刺

[英]Glitch between cells in IE/Edge when using border-radius

In IE 10+ and Edge the background of the table leaks through the bottom of the cells when border-radius is applied. 在IE 10+和Edge中,当应用border-radius时, tablebackground泄漏到单元格的底部。 Any ideas for fix or workaround? 任何修复或解决方法的想法?

I've set up an example here, with red background on the table-element: 我在这里设置了一个示例,在table-element上有红色background

 table { background: red; border-spacing: 0; } td { background: white; border-radius: 1px; } 
 <table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> </table> <p>In IE 10+ and Edge: the red background of the table leaks through the bottom of the cells when border-radius is applied</p> 

CodePen CodePen


Example of rendering in most browsers: 大多数浏览器中的渲染示例:

大多数浏览器中的渲染示例

Example of rendering in IE10+/Edge: 在IE10 + / Edge中渲染的示例:

在IE10 + / Edge中渲染的示例

set line-height:1 in td , with this the height goes from 18.4px to 16px given the font-size by default is 16px 设置line-height:1 td line-height:1 ,这个高度从18.4px变为16px ,默认情况下font-size16px

UPDATE UPDATE

(OP's Comment) (OP的评论)

Thank you for the reply, and I suppose this is a solution. 谢谢你的回复,我想这是一个解决方案。 The weakness that my simplified example doesn't show, is that if the table width is set to 100%, at certain window-width I have the same issue with vertical lines. 我的简化示例未显示的弱点是,如果表格宽度设置为100%,则在某个窗口宽度处,我对垂直线条有同样的问题。 You wouldn't happen to have a trick up your sleave for that issue as well? 你也不会碰巧在这个问题上诡计多端?

you can solve that issue by adding a border-right to td with the same color as background of td 您可以通过添加一个解决这个问题的border-righttd用相同的颜色作为backgroundtd

 table { background: red; border-spacing: 0; } td { background: white; border-radius: 1px; /* for easier display */ padding: 1em; /* fix horizontal line */ line-height: 1; } /* fix vertical-line that sometimes shows up */ tr td:first-of-type { border-right:1px solid white } 
 <table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> </table> <p>In IE 10+ and Edge: the red background of the table leaks through the bottom of the cells when border-radius is applied</p> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM