Xray
Xray shows you why an element of a page looks the way it does: its size and spacing, and every style rule that applies to it.
Turn on Xray in any Espresso preview by clicking the eye at the left of the address field or by choosing Preview ⟩ Show Xray (option command X). With Xray on, click any element on the page to highlight it and see:
- Margins (represented by arrows pointing outwards)
- Padding (the space between the edge of the element and the dashed border inside)
- Dimensions (the space inside the dashed border)
The address field is replaced with the path to the selected element through the page, each step written as you would write it in a selector, such as div#main.wide. Click any step to select that element instead.
While Xray is on, you will not be able to interact with the page normally. Click the eye again to turn it off.
The Xray panel
When you turn on Xray, the Xray panel opens: a small panel that floats over the window. For the element you have clicked it shows a summary:
- what it is, as a selector
- how it is laid out, and its width and height
- its font, weight, size and line height
- its text color and background color
- its margins and padding
These are the values the browser ended up with, whichever rules they came from.
Below the summary is every style sheet with rules that apply to the element. Under each rule are the properties it sets:
- A property that is struck through lost: another rule set the same property and won
- A rule that is dimmed does not apply at the moment, such as a
:hoverrule when the pointer is elsewhere
Click a rule to go straight to it in your CSS source. This works for the style sheets of your project and for a style sheet you have overridden with a local one, even when the source is SCSS or LESS. For a style sheet on a website that you have not overridden, Espresso offers to override it.
Right clicking an element
With Xray on, right click an element for a menu with its applied styles and:
- Ask LatteAI About This Element…, which opens the LatteAI conversation with the element attached to your message
- Copy Selector
- Clear Selection and Deactivate Xray
Xray in other browsers
Xray also works in a project preview that you have open in another browser. Press option command X in the browser to turn it on, and click an element. The Xray panel stays in front of the browser and shows the element you clicked.