Skip to content

Commit

Permalink
Add warning for zoom in getBoundingClientRect
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshAgg authored Feb 12, 2025
1 parent 8dac6c6 commit 5d8fce2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions files/en-us/web/api/element/getboundingclientrect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ properties (these can be obtained using {{domxref("window.scrollY")}} and
{{domxref("window.scrollX")}}) to get a bounding rectangle which is independent from the
current scrolling position.

> [!WARNING]
> CSS property [`zoom`](/en-US/docs/Web/CSS/zoom) affects the `left`, `top`, `right`, `bottom`, `x`, `y`, `width`, and `height` properties of the {{domxref("DOMRect")}} returned by this method.
>
> Inconsistent behavior exists across different browsers: In Safari, the returned {{domxref("DOMRect")}} properties may not match those in Firefox and Chrome. To align results, you may need to multiply the returned properties by the zoom factor.

## Examples

### Basic
Expand Down

0 comments on commit 5d8fce2

Please sign in to comment.