最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - HTML - TD border not showing in IE7 - Stack Overflow

programmeradmin0浏览0评论

I have the following css class:

.detail tr td
{
    border-bottom: 1px solid #c0c0c0 ;
}

And it works great in firefox, chrome and IE9.

But IE7 draws a border in the bottom of all the td that have text. But if the td doesn't have text, then it doesn't draw the border.

How can I add the border for all of them in IE7?

I have the following css class:

.detail tr td
{
    border-bottom: 1px solid #c0c0c0 ;
}

And it works great in firefox, chrome and IE9.

But IE7 draws a border in the bottom of all the td that have text. But if the td doesn't have text, then it doesn't draw the border.

How can I add the border for all of them in IE7?

Share Improve this question edited Sep 7, 2014 at 7:14 James Hill 61.9k22 gold badges149 silver badges166 bronze badges asked Nov 10, 2011 at 12:32 ghanshyam.miranighanshyam.mirani 3,10111 gold badges49 silver badges85 bronze badges 2
  • 7 Try adding   to empty cells. – ezakto Commented Nov 10, 2011 at 12:34
  • 4 any chance of seeing the html? – Daniel Casserly Commented Nov 10, 2011 at 12:34
Add a ment  | 

1 Answer 1

Reset to default 11

In IE7, empty tables cells don't exist. Adding a   to the all your empty cells will solve your issue.

Additional Information:

If you're using jQuery, you could add the   dynamically:

$(document).ready(function() {
    $("td:empty").html(" ");
});

If you hate the idea of inserting a  , you could add a span and set one of it's properties:

<span style="zoom:1;"></span>

Or with jQuery:

$(document).ready(function() {
    $("td:empty").html("<span style='zoom:1;'></span>");
});
发布评论

评论列表(0)

  1. 暂无评论