【问题标题】:IE table border bug - OK on Chrome and SafariIE 表格边框错误 - 在 Chrome 和 Safari 上正常
【发布时间】:2019-04-24 05:02:12
【问题描述】:

大家,

我设计了一个快速的 html 文档,它将被合并到 Outlook 中(因此需要在 HTML 中包含内联样式)。在 Chrome 和 Safari 上一切正常,但 IE11 显示以下问题。表格边框乱七八糟,就像它里面有两种颜色,而不是只有一种,就像 Chrome 上的好版本一样。此外,Firefox 似乎忽略了为颜色设置的表格并显示了它的斜面版本......有人对此有任何想法吗?我在下面粘贴示例图像和我的代码。

image depicting bug in IE against good version on Chrome

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Xmas Card</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>

<body style="margin: 0; padding: 60px 300px 60px 300px; background-color:#d2d2d1">
<table>
	<tr>
	<div style="text-align:center; margin-bottom:20px">
		<span style="font-family:sans-serif; font-size:10pt"><a href="#">If you have problems opening this message, read online here</a></span>
		</div>
	</tr>
</table>
 <table border="8" rules="none" bordercolor="#8a7e70" cellpadding="0px" cellspacing="0" align="center" width="600px">
  <tr style="background-color:#ffffff" align="center">
   <td>
    <img src="#" alt="corners top">
   </td>
  </tr>
  <tr style="background-color:#ffffff" align="center">
  	<td>
  	<img src="#" alt="logo">
  	</td>
  </tr>
  <tr style="background-color:#ffffff" align="center">
  	<td>
  	<h1 style="font-size:24pt; font-family:sans-serif; color:#aa212f; text-align:center">Season's Greetings</h1>	
  	</td>
  </tr>
  <tr style="background-color:#ffffff" align="center">
  	<td>
  	<img src="#" alt="Xmas branches">
  	</td>
  </tr>
  <tr style="background-color:#ffffff" align="center">
  	<td>
  		<a href="#"><img src="/#" alt="button"></a>
  	</td>
  </tr>
   <tr style="background-color:#ffffff" align="center">
  	<td>
  		<img src="#" alt="corners bottom">
  	</td>
  </tr>
 </table>
</body>

</html>

非常感谢你的好意。

【问题讨论】:

    标签: html internet-explorer html-table


    【解决方案1】:

    当你想设置表格的边框属性时,你应该记住边框样式是必需的。 CSS边框的定义和使用可以参考以下W3C文档:https://www.w3schools.com/cssref/pr_border.asp

    我建议你可以分别设置边框颜色、边框样式和边框宽度,如:

    <table style="border-color: #8a7e70; border-style: solid; border-width:8px;" rules="none" cellpadding="0" cellspacing="0" align="center" width="600">...</table>
    

    或者你可以一起写三个属性:

    <table style="border:8px solid #8a7e70;" rules="none" cellpadding="0" cellspacing="0" align="center" width="600">...</table>
    

    the running result in Chrome and IE

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-18
      • 2012-12-15
      • 2010-10-16
      • 1970-01-01
      • 1970-01-01
      • 2021-03-12
      • 1970-01-01
      • 2011-06-02
      相关资源
      最近更新 更多