开发者

Turn off display: none in CSS for a TD

开发者 https://www.devze.com 2023-02-05 00:08 出处:网络
I have a css file that looks like: td { display: none; } .showCell { display: ???? } I have a td that I want to draw on the screen theoretically by giving it the class \"showCell\". However, I don\

I have a css file that looks like:

td { display: none; }
.showCell { display: ???? }

I have a td that I want to draw on the screen theoretically by giving it the class "showCell". However, I don't know what value for ????? would make this work on all browsers. The value table-cell works on all but ie6 and 7.

Note: this is similar to the question I just asked (http://stackover开发者_StackOverflowflow.com/questions/4696210/opposite-of-displaynone-in-a-td). But I asked it poorly there and so please close it if you can.


.showCell { display: table-cell }


"In Internet Explorer 7 and earlier, the default value of [the display] property for table, tr, td, col, and colGroup elements is block."

From http://msdn.microsoft.com/en-us/library/ms530751%28v=vs.85%29.aspx

The easiest way to achieve this would be via conditional comments. Just put it in a special stylesheet for IE6 and IE7

<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="ie6and7fix.css" />
<![endif]-->

which would then have

.showCell {
    display: block;
}


For a table cell you need

display: table-cell


Try this: .showCell { display: table-cell !IMPORTANT }


You could try display: block;. This might mess up the layout of your table, but older IEs dont support table-cell, so you don't really have too much to choose from.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号