gpt4 book ai didi

css - 在 Chrome 中打印圆 Angular 表格单元格

转载 作者:行者123 更新时间:2023-11-28 11:33:31 25 4
gpt4 key购买 nike

我正在尝试打印圆 Angular table 。在这种情况下,TD 必须有边界。那是我的代码:

table {
/*border-collapse: collapse;*/
border-spacing: 0;
}

table tr td {
border: 1px solid #333;
border-bottom: 0;
border-right: 0;
padding-left: 4px;
padding-right: 4px;
line-height: 28px;
}

table tr td:last-child {
border-right: 1px solid #000;
}

table tr:last-child td {
border-bottom: 1px solid #000;
}

table tr:first-child td:last-child {
-webkit-border-radius: 0 4px 0 0;
-moz-border-radius: 0 4px 0 0;
border-radius: 0 4px 0 0;
border-width: 1px;
}

HTML:

<table>
<tr>
<td>adsfasdfasdfasfasd</td>
<td>adsfasdfasdfasfasd</td>
</tr>
</table>

http://jsfiddle.net/gdkgkgwL/2/

在所有浏览器中输出都很好:

enter image description here

当我在 IE 中打印页面时没问题,但在 Chrome 中却不行:

enter image description here

我应该怎么做才能让它在 Chrome 中运行?

最佳答案

这似乎是一个已经存在一段时间的 Chrome 错误:

Steps to reproduce the problem:

  1. Create an HTML Block element (e.g. Hello World)
  2. Style the block element with at-least 1 border-radius with an adjacent side that is missing a border (e.g. Hello World)
  3. Open this page in Google Chrome and view print preview or print
  4. Notice that extra thick border-top

( https://code.google.com/p/chromium/issues/detail?id=175539 .)

如果边框不共享颜色或宽度,则似乎会出现此问题。要修复您的示例,请进行以下更改:

  • table tr td:last-child 中将 border-right: 1px solid #000; 更改为 border-right: 1px solid #333;
  • table tr:last-child td 中将 border-bottom: 1px solid #000; 更改为 border-bottom: 1px solid #333;

这确保了所有方面都是相同的,从而阻止了错误的发生。

/* http://meyerweb.com/eric/tools/css/reset/ 
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
table {
/*border-collapse: collapse;*/
border-spacing: 0;
}
table tr td {
border: 1px solid #333;
border-bottom: 0;
border-right: 0;
padding-left: 4px;
padding-right: 4px;
line-height: 28px;
}
table tr td:last-child {
border-right: 1px solid #333;
}
table tr:last-child td {
border-bottom: 1px solid #333;
}
table tr:first-child td:last-child {
-webkit-border-radius: 0 4px 0 0;
-moz-border-radius: 0 4px 0 0;
border-radius: 0 4px 0 0;
border-width: 1px;
}
<table>
<tr>
<td>adsfasdfasdfasfasd</td>
<td>adsfasdfasdfasfasd</td>
</tr>
</table>

JS fiddle : http://jsfiddle.net/3kqk327q/

关于css - 在 Chrome 中打印圆 Angular 表格单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31725029/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com