[英]In IE9, the pseudo-element :after on a TD doesn't get the correct TD height, is there a fix for this?
The design I'm working with requires a border around a table row. 我正在使用的设计要求表格行周围有边框。 For other complicated reasons, I cannot use the border property directly to achieve this. 由于其他复杂的原因,我无法直接使用border属性来实现此目的。 I have tried 2 approached, both involving using the pseudo-element :after. 我尝试了2种方法,都涉及使用伪元素:after。
I used a tr:after
. 我用了tr:after
。 This works in all browsers except for IE8+. 这适用于除IE8 +以外的所有浏览器。 IE does not render the styles specified under tr:after
at all. IE完全不呈现在tr:after
下指定的样式。
I also tried td:after
. 我也尝试过td:after
。 This time the border shows up in IE8+, but IE doesn't render the border around the full height of the td, despite what the CSS says. 这次边框显示在IE8 +中,但是IE并没有在td的整个高度上渲染边框,尽管CSS表示了什么。
http://jsfiddle.net/kxmhW/2/ Please have a look and let me know if there is a way to fix this. http://jsfiddle.net/kxmhW/2/请看一下,让我知道是否有解决方法。 The first table in the link uses tr:after. 链接中的第一个表使用tr:after。 The second table uses td:after
. 第二个表使用td:after
。
Thank you. 谢谢。
If you are just trying to get borders around the rows, would something like this work for your situation? 如果您只是想让行周围有边界,那么这种情况是否适合您的情况?
CSS 的CSS
table {
border-collapse: collapse;
}
td {
background: #ddd;
width: 100px;
}
.tr-border tr {
border: 2px solid red;
}
HTML 的HTML
<table class="tr-border">
<tr>
<td>1</td>
<td>Lorem</td>
<td>123,456</td>
<td>XXXX</td>
<td>$10.24</td>
<td>Lorem Ipsum Dolor Sit Amet, Consect EturLorem Ipsum Dolor Sit Amet.</td>
</tr>
<tr>
<td>2</td>
<td>Lorem</td>
<td>123,456</td>
<td>XXXX</td>
<td>$10.24</td>
<td>Lorem Ipsum Dolor Sit Amet, Consect EturLorem Ipsum Dolor Sit Amet.</td>
</tr>
</table>
<br />
<table class="tr-border">
<tr>
<td>1</td>
<td>Lorem</td>
<td>123,456</td>
<td>XXXX</td>
<td>$10.24</td>
<td>Lorem Ipsum Dolor Sit Amet, Consect EturLorem Ipsum Dolor Sit Amet.</td>
</tr>
<tr>
<td>2</td>
<td>Lorem</td>
<td>123,456</td>
<td>XXXX</td>
<td>$10.24</td>
<td>Lorem Ipsum Dolor Sit Amet, Consect EturLorem Ipsum Dolor Sit Amet.</td>
</tr>
</table>
FIDDLE 小提琴
http://jsfiddle.net/krishollenbeck/kxmhW/30/ http://jsfiddle.net/krishollenbeck/kxmhW/30/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.