> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/browser/dom/type/htmlelement/htmlelem.ishidden.md).

# htmlElem.isHidden

{% tabs %}
{% tab title="💾 程式" %}

```javascript
// Geometry properties are calculated only for displayed elements.
// If an element (or any of its ancestors) has `display:none` or is 
// not in the document, then all geometry properties are 0.
Object.defineProperty(HTMLElement.prototype, 'isHidden', {
    get() { return !this.offsetWidth && !this.offsetHeight }
});
```

{% endtab %}

{% tab title="📗 參考" %}

* [ ] JS.info ⟩ Element size and scrolling ⟩ [offsetWidth/Height](https://javascript.info/size-and-scroll#offsetwidth-height)
  {% endtab %}

{% tab title="📘 手冊" %}

* [HTMLElement](/web/browser/dom/type/htmlelement.md) ⟩ [.offsetWidth](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth)
  {% endtab %}
  {% endtabs %}
