Table of Contents

Property BoundingClientRectInViewport

Namespace
DotNetBrowser.Dom
Assembly
DotNetBrowser.dll

BoundingClientRectInViewport

Gets the bounds of the element and its position relative to the top-left of the viewport of the main document.

Rectangle BoundingClientRectInViewport { get; }

Property Value

Rectangle

The bounds of the element and its position relative to the top-left of the viewport of the main document.

Remarks

This property can return an empty Rectangle in the following cases:

  • The element is not attached to the DOM tree.
  • The element is not visible and has the hidden attribute.
  • The CSS style of the element contains display: none; statement.

If the element is attached to the DOM tree and is visible, but it is out of the viewport, this property still returns its bounds.

To get the bounding rectangle of the element relative to the viewport of the current document, use the BoundingClientRect property.

The origin and size of the returned rectangle are in the device-independent pixels.

Exceptions

ObjectDisposedException

The IElement has already been disposed.