measure_element
Measures the rendered pixel geometry and text ink bounds of an element, revealing sub-pixel centering offsets to diagnose visual alignment issues that CSS box model cannot detect.
Instructions
Deterministic rendered-pixel geometry: an element's content box (WxH @x,y) and the true TEXT INK bounding box of its glyphs (canvas measureText extents, not the advance box), plus a sub-pixel centering verdict — how far the ink sits from the content-box center on each axis, with a padding/line-height fix hint. Reach for this when the caller is fussing over VISUAL alignment that the box model can't see: "the × in the close button looks a bit high/off-center", "the icon is not quite centered", one-off pixel offsets. Pass referenceUid/referenceSelector to also get the center delta between two elements. explain_styles tells you which rule set the value; measure_element tells you whether the painted glyph actually lands where you want.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Viewport x coordinate (use with y) | |
| y | No | Viewport y coordinate (use with x) | |
| uid | No | Element uid from a prior page_snapshot (e.g. "e17") | |
| selector | No | CSS selector — first match is used | |
| referenceUid | No | Optional reference element uid to measure alignment against (its center) | |
| referenceSelector | No | Optional reference element selector to measure alignment against (its center) |