Open In App

Inspector Tool in Mozilla Firefox

The Inspector in Firefox is used to inspect and modify the HTML and CSS code of the web page. The inspector provides the DOM section, where you can view the HTML and modify the DOM by editing or deleting the elements. The inspector also displays the CSS code of the selected elements in the Rules pane and also provides other panes such as layout, computed, changes, compatibility, fonts, and animations, which helps a lot of developers deal with various aspects of the CSS code.

Benefits of the Inspector Tool

The various benefits of the inspector are:

How do I open the Inspector in Firefox?

The Inspector is present in the DevTools as a tab. To open it, follow these steps:



Step 1: Right-click on the web page and click Inspect to open the DevTools, or you can just use the shortcut “Ctrl+Shift+I.”.

Step 2: In the DevTools, the first tab will be Inspector. Click on it.

Opening the Inspector tab in Firefox

How do I use the Inspector?

The Inspector can be divided into two main sections: the DOM section and Pane’s section.

DOM Section

The DOM section displays the rendered HTML code in an expandable tree format, and the code is also color-coded to increase readability. You can edit the DOM directly here, and the changes will be reflected in the webpage instantly. You can add breakpoints, focus on particular elements, or force the state of that element in this section.

DOM section

At the top of the DOM sections, you get various options. Let’s move left to right and understand each option.

Various features of the DOM Section

There are many features of the DOM section that can be used to inspect and modify the elements of the webpage.

Picking a particular element: Using the pick an element from the page option present at the end of the top-left part of DevTools, you can select an element to focus it in the DOM section and display its CSS properties in the Styles pane. You can use the shortcut “Ctrl+Shift+C” to select the option.

Picking a particular element to inspect

Scrolling to an element to view: You can view an element on the web page by automatically scrolling to it by right-clicking the element and selecting Scroll Into View.

Scrolling to an element to view

Modifying an Element: The various modifications that can be done in the DOM are:

Performing various modification in the DOM

Change the pseudo-class of an element: In the selected element, you can change its pseudo-class, such as hover, focus, visited, etc. Just right-click the element and select the required sub-option from the Change Pseudo-Class option.

Changing Pseudo-class of the element

Adding Breakpoints to an Element: You can block modifications to the element, such as subtree modification, attribute modification, or node removal, by right-clicking the element and selecting the required sub-option under the Break on option.

Adding Breakpoints in Elements

Pane’s Section

The pane’s section comprises various panes that provide CSS code and specific property information. You can have a three-pane inspector where you get the DOM section, the rules pane in the middle section, and the rest of the panes in the third right section. This three-pane inspector can be toggled using the button present in the top-left corner of the pane section.

Pane’s Section

Rules Pane

Layout Pane

Computed Pane

Changes Pane

Compatibility Pane

Fonts Pane

Animations Pane

Showing usage of the Inspector

Let’s use the Inspector in the GFG site to inspect and modify the HTML and CSS code of the site.

Step 1: Using Firefox, visit the GFG site and then locate the inspector in the DevTools.

Step 2: Use the Inspector to view HTML and CSS code or modify it and view the live changes in the page.

Using the Inspector for GFG site

Conclusion

The developers may need to switch between the browser and the code editor to make changes to the HTML and CSS code, but Firefox provides the Inspector tab, which helps to modify the various aspects of the code and check live changes in the browser itself. By going through the changes tab, all CSS changes can be checked, and modifications to the source code can be done in a single pass, thus saving time.


Article Tags :