开发者

Opposite of display:none in a td

开发者 https://www.devze.com 2023-02-04 15:34 出处:网络
I have a td that has a class which has a css rule to display:none. When I add this class to the td, it disappears, and when I remove the class, it reappears.

I have a td that has a class which has a css rule to display:none. When I add this class to the td, it disappears, and when I remove the class, it reappears.

However, if the td is display:none, I can't come up with a way of overriding display to show it like normal. I tried values: block, inline, '', 开发者_开发百科inherit, and table. None of them worked, all displaying them in odd ways. Surely there must be some way to override the display rule on a td to act like I described above.


Just set display to empty, or display: table-cell


You have a table cell. Try display:table-cell.


It's hard to decipher exactly what you mean by "trying to do this with css". It sounds like you have two classes

.hideMe {
  display: none;
}
.showMe {
  display: block;
}

and you're applying both classes to an element such as

<table>
  <tr>
    <td>Cell 1</td>
    <td class="hideMe showMe">Cell 2</td>
    <td>Cell 3</td>
  </tr>
  ....

That will not work -- Though I'm not sure why.

I would recommend just having one class for hiding (e.g. "display: none;") and add/remove that class as needed to show or hide the elements.

0

精彩评论

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