【发布时间】:2020-08-27 16:29:02
【问题描述】:
<div style="display: none;">
<span>Hello</span>
</div>
const div = document.querySelector('div');
// getComputedStyle(div).display === 'none';
const span = document.querySelector('span');
// how can I tell if the span is shown?
在上面的代码中,有没有简单的方法来判断span是否显示在窗口中?
【问题讨论】:
-
你能进一步澄清你的问题吗?
const在我看来不像 CSS -
这是 Javascript 代码。
-
感谢@johannchopin,看来CSS选择器没有简单的方法?
-
@QianChen 我认为仅使用 css 是不可能的
标签: css