如何使用纯CSS选择器选择隐藏元素 [英] How to use pure css selector to select hidden element

查看:723
本文介绍了如何使用纯CSS选择器选择隐藏元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<td class="col" style="display:none">AAA
      <span prop="1" class=" clear-icon " style=""></span>
</td>

我想使用纯CSS隐藏文本"AAA"以显示跨度btn. 有没有办法在纯CSS中做到这一点?

I want to use pure css to hide text "AAA" to show span btn. Is there a way to do it in pure css?

推荐答案

如果您的设计没有真正的响应能力,我的意思是您只需要为内部span设置固定的字体大小,我认为我们可以这样的解决方案.想法是将tdfont-size设置为0,它将完全隐藏文本节点:

If your design is not really responsive, I mean you can just need to set fixed font-size for the inner span, I think we have a clean solution like this. The idea is to set font-size of the td to 0, it will hide the text node completely:

.col[style*="display:none"] {
  display:table-cell!important;
  font-size:0;
}
.col > span {
  font-size:20px;
}

这篇关于如何使用纯CSS选择器选择隐藏元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆