Some Cross-Browser DevTools Features You Might Not Know
Developer tools are a daily weapon for front-end developers. This article will share some less-known practical features in cross-browser developer tools to help you debug more efficiently.
For simplicity, "Chromium" will be used in the article to refer to all Chromium-based browsers such as Chrome, Edge, and Opera. Their developer tools are highly consistent in functionality.
DOM tree node search
Facing the nested DOM nodes at layers, finding the target node can be time-consuming and laborious. Use Cmd F (macOS) or Ctrl F (Windows) to quickly search for the DOM tree.
Supports CSS selectors (e.g. <code>.red) and XPath expressions (e.g. <code>//div/h1) searches.
In Chromium browser, searches will automatically jump to the matching node, which can be troublesome when handling long queries or large DOM trees. You can turn off this feature by going to Settings (F1) → Preferences → Global → Enter while searching → Disable
.After finding the node, right-click on the node and select "Scroll to View" to scroll it to the viewing area.
Accessing node from console
Developer Tools provide multiple ways to access DOM nodes directly from the console:
<code><code>For example, <code> can access the currently selected DOM node. The Chromium browser goes a step further and allows access to nodes in the history selection using <code>,
,, etc. Right-click on the node and select Copy → <code>document.querySelectorCopy JS path
, and you can copy the node path as a JavaScript expression (form), which is convenient for access in the console.
- Another way is to store the node as a temporary variable. Right-click on the node and select the corresponding option:
- Chromium
- : Right-click → "Save as global variable" Firefox
- : Right-click → “Use in the console” Safari
Visualize elements with tags
Developer tools can help visualize elements with specific attributes by displaying tags next to nodes. Tags are clickable, and the types of tags provided by different browsers are also different. In <code>display: gridSafari<code>display: inline-grid, there is a marker button in the Elements Panel toolbar to toggle the visibility of a specific marker. For example, if a node has a
orCSS declaration applied, a grid mark is displayed next to it. Clicking on the mark will highlight the grid area, track size, line number, etc. on the page.
FirefoxTags currently supported by the developer tool are listed in the Firefox source documentation. For example, a scroll mark indicates a scrollable element. Clicking on a mark highlights the element that causes the overflow and displays the overflow mark next to it.In the Chromium browser, you can right-click on any node and select "Tag Settings..." to open a container with all available tags. For example, an element with <code>scroll-snap-type will have a scroll snap tag next to it, and clicking on that tag will toggle the scroll snap overlay on that element.
Screenshot
All mainstream browsers now support screenshots from developer tools and provide a new method of full page screenshots.
Right-click on the DOM node you want to capture and select the option to capture the node (different browser tags are different).
Repeat this operation on the html node to take a full page screenshot. It should be noted that Safari retains the transparency of the background color of the element, while Chromium and Firefox capture it as a white background.
You can also take "responsive" screenshots to capture the page with a specific viewport width. The operation methods of different browsers are as follows:
- Chromium: Cmd Shift M (macOS) or Ctrl Shift M (Windows). Or click the Device icon next to the Check icon.
- Firefox: Tools → Browser Tools → “Responsive Design Patterns”
- Safari: Development → “Enter Responsive Design Mode”
Chrome Tips: Check the Top Level
Chrome allows you to visualize and inspect top-level elements such as dialog boxes, alerts, or modal boxes. When an element is added to <code>#top-layer, a top-level mark is displayed next to it. Clicking on the mark will jump to the top-level container that is located after the <code>
The above is the detailed content of Some Cross-Browser DevTools Features You Might Not Know. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

It's out! Congrats to the Vue team for getting it done, I know it was a massive effort and a long time coming. All new docs, as well.

With the recent climb of Bitcoin’s price over 20k $USD, and to it recently breaking 30k, I thought it’s worth taking a deep dive back into creating Ethereum

I had someone write in with this very legit question. Lea just blogged about how you can get valid CSS properties themselves from the browser. That's like this.

The other day, I spotted this particularly lovely bit from Corey Ginnivan’s website where a collection of cards stack on top of one another as you scroll.

I'd say "website" fits better than "mobile app" but I like this framing from Max Lynch:

There are a number of these desktop apps where the goal is showing your site at different dimensions all at the same time. So you can, for example, be writing

If we need to show documentation to the user directly in the WordPress editor, what is the best way to do it?

Questions about purple slash areas in Flex layouts When using Flex layouts, you may encounter some confusing phenomena, such as in the developer tools (d...
