添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Skip Main Navigation

Capture DOM element screenshots in Chrome

How to create a screenshot of a DOM element in Chromium-based DevTools

Friday, April 24, 2020 · 1 min read

Whenever I submit a PR for a UI change, I like to include a screenshot or two in order to aid the my teammates in reviewing the code, especially when it's CSS changes. Ideally there would be a Deploy preview , but not everything is running on Netlify (yet).

Usually I only need a screenshot of the section of the page that actually changed. So I hit Cmd+Shift+4 (on my Mac) and select the a section containing the UI. Boom screenshot. Well for now on, thanks to a tweet from Tierney Cyren , I can be more precise in my screenshot. In Chrome, Edge or any Chromium-based environment, I can get a screenshot of just the element in the DOM:

If you can't watch the video, here are the steps:

  • Inspect the DOM element to highlight it in the Elements panel of the DevTools
  • Press Cmd/Ctrl+Shift+P to pull up the DevTools command palette (also something new I just learned about!)
  • Choose "Capture node screenshot"
  •