How to Screenshot a Browser DOM Element
In this article
Taking a screenshot of a specific DOM element in a browser captures only the selected HTML element—like a div, image, or form—instead of the entire webpage. This is useful for documentation, bug reporting, or design feedback. Modern browsers like Chrome, Firefox, and Edge include built-in tools that let you capture an element directly, including parts not currently visible in the viewport. You don’t need extensions or third-party tools for basic use, though advanced formatting may require additional steps.
What You'll Need
- A modern web browser (Google Chrome, Mozilla Firefox, Microsoft Edge, or Safari with workarounds)
- The webpage loaded with the target DOM element visible or accessible in the DOM tree
- Basic knowledge of browser developer tools (DevTools)
Step-by-Step
- Open the webpage containing the DOM element you want to screenshot in your browser. Navigate to the correct section so the element is loaded.
- Right-click on the target element and select Inspect or Inspect Element from the context menu. This opens the browser’s Developer Tools and highlights the corresponding HTML in the Elements (or Inspector) panel.
- In the Developer Tools panel, ensure the correct element is selected. You can click on parent or child nodes in the DOM tree to refine your selection if needed.
- In Google Chrome or Microsoft Edge, press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) to open the Command Menu (also called the 'Run Command' bar).
- Type Screenshot in the command menu. Select the option Capture node screenshot from the dropdown list. The browser will immediately capture the selected DOM element as a PNG file and prompt you to save it.
- In Mozilla Firefox, after selecting the element in the Inspector, right-click on the highlighted HTML tag in the panel. Choose Screenshot Node from the context menu. The screenshot downloads instantly, typically saved to your default downloads folder.
- In Safari, the process is less direct. First, enable the Develop menu via Safari Preferences > Advanced > Show Develop menu in menu bar. Then, after selecting the element in the Web Inspector, you must manually use the browser’s full-page screenshot tool (Develop > Capture Screen) and crop the image externally, as Safari lacks a direct node capture feature.
- Verify the downloaded image. Open it to confirm the correct element was captured, including styling, borders, and content. If part of the element is missing, it may be due to overflow or dynamic content not fully loaded.
- For elements that are hidden or require interaction (e.g., dropdowns, modals), trigger the desired state first—such as clicking a button to open a menu—before capturing. Use the DOM inspection tool while the element is in the correct state.
- For long elements that scroll (like tall divs), the browser’s node screenshot usually captures the entire content in one image, even if it extends beyond the viewport. Confirm this behavior in your browser; Chrome and Firefox typically support full-height captures.
Common Mistakes
One frequent error is selecting the wrong parent or child element in the DOM tree, leading to a screenshot that includes too much or too little content. Always double-check the highlighted area in the browser viewport after selection. Another mistake is attempting to capture dynamic content before it loads—such as images or JavaScript-rendered text—which may appear blank. Wait for full load. Users sometimes forget to open DevTools before using the command palette, causing the Ctrl+Shift+P shortcut to do nothing. Also, in Firefox, users may miss the right-click option because it’s in the code panel, not the page itself. Lastly, relying on Safari’s limited tooling without preparing for post-capture editing leads to incomplete results.
Tips
To improve clarity, remove distractions before capturing: use DevTools to hide adjacent elements by setting display: none on non-essential nodes. You can also modify CSS temporarily to increase padding or borders for better presentation. If the element uses relative or fixed positioning, ensure it renders correctly in isolation. For responsive elements, resize the browser window to the desired breakpoint before capturing. Consider using Chrome’s Device Toolbar (toggle with Ctrl+Shift+M) to simulate mobile views. Naming your screenshots descriptively (e.g., 'login-form-error-state.png') helps with organization. If you frequently capture elements, bookmark the DevTools shortcut or create a mental checklist to speed up the process.
Troubleshooting
If the Capture node screenshot option doesn’t appear in Chrome or Edge, ensure you’re using the correct Command Menu (DevTools must be open, and the shortcut must be used within the DevTools window). If the element appears cut off, check for CSS properties like overflow: hidden or max-height that may clip content—temporarily override them in DevTools. In Firefox, if Screenshot Node is missing, update the browser or ensure you’re right-clicking the correct HTML tag in the Inspector panel. If the image quality is poor, note that browser captures are PNGs with full resolution; scaling issues likely stem from screen zoom settings—reset zoom to 100% before capturing. If the element doesn’t render at all, it may rely on external resources (fonts, images) that failed to load; check the Network tab for errors. For elements inside iframes, switch the DevTools context to the correct frame using the dropdown at the top of the Elements panel before capturing.
Frequently Asked Questions
Can I screenshot an invisible DOM element?
No, the element must be rendered on the page. Use DevTools to modify display or visibility CSS to make it visible before capture.
Does this work on mobile browsers?
Not directly. Mobile Chrome or Safari lacks DevTools. Use remote debugging via USB with a desktop browser to inspect and capture elements from a mobile device.
Can I capture an element with scrollable content?
Yes. Browsers like Chrome and Firefox capture the full scrollable height of an element in one image, not just the visible portion.
Is the screenshot affected by dark mode or user styles?
Yes. The capture reflects the current page appearance, including CSS customizations, user styles, and OS-level themes like dark mode.
Why is my screenshot blank or missing images?
This usually happens when images are blocked, failed to load, or are loaded asynchronously. Check the Network tab and wait for full load before capturing.
Can I add annotations or edit the screenshot after?
The browser saves a plain PNG. Use external image editors like Paint, Photoshop, or free tools like GIMP or Snip & Sketch to annotate or crop.