Extract HTML and CSS of any element

Press Block in the SiteAnnotation side panel and click an element on the page. You get its screenshot, its HTML, a CSS selector, an XPath and the CSS rules that apply to it, all in one report item.

A checkout page with the Pay $101.00 button selected as button#pay; arrows lead to three cards: the screenshot of the button, its HTML and its CSS rules with their sources
The Pay button captured as a block: screenshot, HTML and the CSS rules that apply, each with its source.

How to capture an element

  1. Click the SiteAnnotation icon in the Chrome toolbar to open the side panel on the page.
  2. Press Block, or press Alt+Shift+E, or right-click the page and choose Block.
  3. Move the pointer over the page. The element under it gets a frame and a label with its selector and size.
  4. Use the arrow keys to adjust: ↑ takes the parent element, ↓ goes back to the smaller one. Press Enter or click to pick, Esc to cancel.
  5. Look through the CSS rules in the new item, untick those that do not matter, add a comment and press Add to report.

What the item contains

Field What is saved
Screenshot The element alone, stitched from several screens if it is taller than the window
HTML The element's outer HTML, up to 50 KB, with form values and tokens masked
Selector and XPath A CSS selector and an XPath that find this element on the page
CSS rules Every rule that applies to the element, in cascade order
Page Address, title, time, viewport size and Chrome version
Comment Your note

How the CSS rules are collected

The rules are the same that the Styles tab of Chrome DevTools shows for this element, in the same order. For each rule you see:

  • the selector and the declarations;
  • where the rule comes from: a stylesheet file or a <style> block on the page;
  • the @media conditions it sits under.

Rules for states such as :hover, :focus or :active are collected in a separate group: they do not apply at the moment of the click, but they are often the reason for a bug report.

When a site serves its stylesheet from another domain, Chrome hides its rules from extensions. SiteAnnotation then downloads that stylesheet once more, without cookies, and reads the rules from the copy. Nothing else is sent anywhere.

Untick the noise

A button on a large site can have 30 rules, most of them resets and theme variables. Untick the ones that do not matter, and only the rules you left go into the report.

A developer who opens the report sees which element you mean, what it looks like and which CSS made it look so, without opening DevTools and reproducing the page.

Use it in a report

Mark the screenshot of the element in the editor: screenshot annotation. When the whole page is the context, add a full page screenshot next to the element. The HTML and CSS go into every export format. What goes into each format.

See it in a finished report: the bug report template and sample shows a broken button captured as a block.

Limits

  • An iframe is picked as one element: you get the frame whole, not the elements inside it.
  • Elements inside Shadow DOM, open or closed, can be picked.
  • HTML longer than 50 KB is cut, and the item says so.
  • Chrome does not let extensions into chrome:// pages, the Chrome Web Store and the built-in PDF viewer. Which pages are off limits.

Questions about element capture

Are these the same rules DevTools shows?

Yes, the rules that apply to the element, in the same cascade order as the Styles tab, with the file or <style> block each one comes from. State rules such as :hover are kept in a separate group.

Does it save computed styles?

No, it saves the rules as they are written, with their selectors and sources. That shows which rule to change, which computed values do not.

Can I pick an element inside an iframe?

No. An iframe is picked as one element, and you get the frame whole. Elements inside Shadow DOM can be picked.

Will passwords or tokens end up in the HTML?

No. Values of form fields, tokens, keys, session ids and secret URL parameters are masked before the HTML is saved. This is on by default and can be turned off in the settings.

Turn the next page you review into a report

Free, no account, works offline. Your evidence stays in your browser.

Add to Chrome. It's free