This translation is incomplete. Please help translate this article from English.
Utilizează inspectorul pentru a examina și modifica structura și așezarea unei pagini.
Există doua căi principale pentru deschiderea inspectorului:
- fără un element selectat: alege opțiunea "Inspector" din meniul "Dezvoltare web" sau comanda rapidă (Ctrl + Shift + i)
- având un element selectat: click-dreapta pe un element de pe o pagină web și selectează "Inspectează elementul"
Inspectorul va apărea în partea de jos a browserului.
Dacă ați activat inspectorul apasând click-dreapta si apoi "inspectează elementul", atunci un element va fi deja selectat.
În caz contrar , poți selecta un element cu ajutorul mausului, elementul aflat sub cursor este evidențiat și o notă afișează eticheta HTML, ori ce clasă sau ID attributes și formeaza începand cu Firefox 32 și marimea elementului. În același timp definiția HTML este afișată în context, în partea stânga a panoului inspector:
Clicking on the element selects it. Once an element is selected its markup is highlighted in the HTML pane on the left of the Inspector, and the CSS pane on the right of the Inspector shows its style information:
There are two ways to select a new element: either click on its markup in the HTML pane, or click the "Select element" button, then click on the element in the web page.
From Firefox 32 onwards, the "Select element" button is at the left-hand end of the toolbar:
Before Firefox 32 it's near the right-hand end of the toolbar:
The Inspector is split into two halves. The left-hand half is occupied by the HTML pane:
Navigating the HTML
At the top of the HTML pane there's a toolbar split into two sections: a trail of breadcrumbs and a search box.
This shows the complete hierarchy through the document for the branch containing the selected element:
If you click and hold on one of the elements in the bar, a popup menu appears that lets you select one of that element's siblings. Clicking the small arrow icons at the left and right ends of the bar will scroll the bar if it's wider than the available space.
From Firefox 34 onwards, hovering over a breadcrumb highlights that element in the page.
Click in the search box to expand it, then type the name of a tag. The first element of that type in the page will be selected, and pressing "Enter" finds the next one.
The rest of the pane shows you the page's HTML as a tree. Just to the left of each node is an arrow: click the arrow to expand the node. If you hold the Alt key while clicking the arrow, it expands the node and all the nodes underneath it.
Moving the mouse over a node in the tree highlights that element in the page.
From Firefox 32 onwards, nodes that are hidden using display:none are shown faded.
::before and ::after
You can perform certain common tasks on a specific node using a popup menu. To activate this menu context-click the element:
The menu gives you the following options:
|Edit as HTML||Edit the element's HTML|
|Copy Inner HTML||Copy the inner HTML for the element|
|Copy Outer HTML||Copy the outer HTML for the element|
|Copy Unique Selector||Copy a CSS selector that uniquely selects the element|
|Copy Image Data-URL||Copy image as a data:// URL, if the selected element is an image|
|Show DOM Properties||
New in Firefox 35
|Paste Inner HTML||
New in Firefox 36
Paste the clipboard contents into the node as its innerHTML.
|Paste Outer HTML||Paste the clipboard contents into the node as its outerHTML.|
New in Firefox 36
New in Firefox 36
|Paste/As First Child||
New in Firefox 36
|Paste/As Last Child||
New in Firefox 36
|Delete Node||Delete the element|
|:hover||Set the :hover CSS pseudo-class|
|:active||Set the :active CSS pseudo-class|
|:focus||Set the :focus CSS pseudo-class|
You can edit the HTML - tags, attributes, and content - directly in the HTML pane: double-click the text you want to edit, change it, and press Enter to see the changes reflected immediately.
To edit an element's outerHTML, activate the element's popup menu and select "Edit As HTML". You'll see a text box in the HTML pane:
You can add any HTML in here: changing the element's tag, changing existing elements, or adding new ones. Once you click outside the box, the changes are applied to the page.
Examining event listeners
From Firefox 33 you'll see a "ev" icon next to elements that have event listeners bound to them:
Click the icon and you'll see a list of all the event listeners bound to this element:
Each line contains:
- a pause button: click that to go to the event listener in the Debugger, where you'll be able to set a breakpoint in it
- the name of the event
- the name and line number for the listener: click this to see the listener function in the popup
- an indication of whether the event bubbles and which DOM specification defines it
From Firefox 34 onwards, the popup displays jQuery events, too:
The right-hand half of the Inspector is occupied by the CSS pane:
The CSS pane shows information about the styles applied to the currently selected element. There are four separate views: "Rules", "Computed", "Fonts", and "Box Model". You can switch between them using the tabs at the top of the pane.
This view lists all the rules that apply to the selected element, ordered from most-specific to least-specific:
The Rules view lists pseudo-elements, and the rules they apply.
From Firefox 32 onwards, the Rules view lists user-agent styles (styles applied by the browser) if the option to do so is checked in the developer tool settings. Note that this setting is independent of the "Browser styles" checkbox in the Computed view.
It displays each rule as in a stylesheet, with a list of selectors followed by a list of
Rules that are overridden by later rules are crossed out. If you mouse over a declaration, a checkbox appears next to it: you can use this to toggle the rule on or off.
User-agent styles are displayed with a darker gray, and the link to the filename and line number contains the prefix
Starting in Firefox 34, if you hover the mouse pointer over a selector in the Rules view, all elements matching that selector are highlighted in the page:
Link to CSS file
At the top-right of each rule the source filename and line number is displayed as a link: clicking it opens the file in the Style Editor.
The Inspector understands CSS source maps. That means that if you are using a CSS preprocessor that has support for source maps, and you've enabled source map support in the Style Editor settings, then the link will take you to the original source, not the generated CSS:
Read more about CSS source map support in the Style Editor documentation.
You'll see a color sample appear next to color values:
If you click on the color sample, you'll see a color picker popup, enabling you to change the color:
From Firefox 31 onwards the color picker includes an eyedropper icon: clicking this icon enables you to use the eyedropper to select a new color for the element from the page:
You'll see a preview of images specified using background-image if you hover over the rule:
The Rules view helps you visualize the transformations performed with the CSS
Before Firefox 33, if you hover over a
transform property in the Rules view, you get a tooltip which visualizes the transformation:
From Firefox 33 onwards, you get a similar visualization, but this time it's overlaid on the element itself:
If you hover over a
font-family property in the Rules view, you get a tooltip with a sample of that font:
From Firefox 33 any @keyframes rules associated with the currently selected element are now displayed in the Rules section of the Inspector and are editable:
Editing cubic Bézier curves
From Firefox 33 onwards, timing functions defined as cubic Bézier curves get a new icon in the Rules view. If you click the icon you get a visual editor for the curve,enabling you to drag P1 and P2, and see the results in the page:
This feature uses open source code from Lea Verou’s cubic-bezier.com.
If you click on a declaration you can edit its property or value, and see the results immediately. To add a new declaration to a rule, click on the last line of the rule (the line occupied by the closing brace). If you enter an invalid value for a property when editing it, or an unknown property name, a yellow alert icon appears under the declaration.
Any changes you make are temporary: reloading the page will restore the original styling.
You can use the arrow keys to increase/decrease numeric rules while editing. Up arrow will turn "1px" to 2px, and Shift+up/down will increment by 10. Alt+up/down change values by 0.1, and shift+Page up/down will add or subtract 100 from the value.
From Firefox 33 you can edit selectors as well as declarations.
From Firefox 33 onwards, you can add new rules in the Rules view. Just right-click to show the context menu and select "Add rule". This will add a new CSS rule whose selector matches the currently selected node.
This view organizes the style of the element by property. It lists all CSS properties which have been applied to this element in alphabetical order: it shows the calculated value that each CSS property has for for the selected element:
Clicking the arrow next to the property name shows the rule that set this value, along with a link to the source filename and line number:
By default, it only shows values that have been explicitly set by the page: to see all values, click the "Browser styles" box.
Typing in the search box performs a live filtering of the list, so, for example, if you just want to see font-related settings, you can type "font" in the search box, and only properties with "font" in the name will be listed. You can also search for the values of properties: to find the rule responsible for setting the font to "Lucida Grande", type that in the search box.
This shows all the fonts in use by the selected element. Note that it shows the font used on your system, which may be different than the fonts specified in the css:
The text in the font view is "Abc" by default but this is actually a text area and can be freely edited.
Box model view
This shows a graphical representation of the box model as it's applied to this element. While the mouse is in the box model view, grid lines and the box model for the element in the page are displayed:The box model view contains a number of annotations:
- The top-left shows the size taken up by the element in the page (content + padding)
- The center shows the size of the content
- the top-right shows the value of its
- the individual values for padding, border, and margin are where you would expect
From Firefox 31, if you click one of the numbers in the box model view, you can edit that value and see the results live in the page.
Using the Page Inspector with the Web Console
If you hover over that element in the Web Console output, it's highlighted on screen:
Firefox add-ons may access the following objects from the chrome://browser/content/devtools/inspector/inspector.xul context:
defined in inspector-panel.js. Attributes and functions:
- .selection - information about the inspector's selection:
- .isNode() - returns true if selection is node.
- .node - returns the actual element from the page
- .window - the window object of the frame the selection is in.
- .markDirty() - marks that the page has been changed by the inspector - a warning will be shown when leaving the page, since changes made through the inspector are rewritten on reload.
Bindable events using on:
Called when the left panel has been refreshed, after page change.
Called on first markuploaded.
Called after toggle of a pseudoclass.
"low-priority change event for things like paint and resize."
|Inspect Element||Ctrl + Shift + C||Cmd + Opt + C||Ctrl + Shift + C|
These shortcuts work while the node picker is active.
|Select the element under the mouse and cancel picker mode||Click||Click||Click|
|Select the element under the mouse and stay in picker mode||Shift+Click||Shift+Click||Shift+Click|
These shortcuts work while you're in the Inspector's HTML pane.
|Delete the selected node||Delete||Delete||Delete|
|Undo delete of a node||Ctrl + Z||Cmd + Z||Ctrl + Z|
|Redo delete of a node||Ctrl + Shift + Z / Ctrl + Y||Cmd + Shift + Z / Cmd + Y||Ctrl + Shift + Z / Ctrl + Y|
|Move to next node (expanded nodes only)||Down arrow||Down arrow||Down arrow|
|Move to previous node||Up arrow||Up arrow||Up arrow|
|Move to first node in the tree.||Home||Home||Home|
|Move to last node in the tree.||End||End||End|
|Expand currently selected node||Right arrow||Right arrow||Right arrow|
|Collapse currently selected node||Right arrow||Right arrow||Right arrow|
|(When a node is selected) move inside the node so you can start stepping through attributes.||Enter||Return||Enter|
|Step forward through the attributes of a node||Tab||Tab||Tab|
|Step backward through the attributes of a node||Shift + Tab||Shift + Tab||Shift + Tab|
|(When an attribute is selected) start editing the attribute||Enter||Return||Enter|
|Hide/show the selected node||H||H||H|
|Focus on the search box in the HTML pane||Ctrl + F||Cmd + F||Ctrl + F|
|Edit as HTML||F2||F2||F2|
|Stop editing HTML||F2 / Ctrl +Enter||F2 / Ctrl + Return||F2 / Ctrl + Enter|
|Copy the selected node's outer HTML||Ctrl + C||Cmd + C||Ctrl + C|
|Scroll the selected node into view||S||S||S|
|Find the next match in the markup, when searching is active||Enter||Return||Enter|
|Find the previous match in the markup, when searching is active||Shift + Enter||Shift + Return||Shift + Enter|
These shortcuts work when the breadcrumbs bar is focused.
|Move to the previous element in the breadcrumbs bar||Left arrow||Left arrow||Left arrow|
|Move to the next element in the breadcrumbs bar||Right arrow||Right arrow||Right arrow|
|Focus the HTML pane||Shift + Tab||Shift + Tab||Shift + Tab|
|Focus the CSS pane||Tab||Tab||Tab|
These shortcuts work when you're in the Inspector's CSS pane.
|Focus on the search box in the CSS pane||Ctrl + F||Cmd + F||Ctrl + F|
|Clear search box content (only when the search box is focused, and content has been entered)||Esc||Esc||Esc|
|Step forward through properties and values||Tab||Tab||Tab|
|Step backward through properties and values||Shift + Tab||Shift + Tab||Shift + Tab|
|Start editing property or value (Rules view only, when a property or value is selected, but not already being edited)||Enter or Space||Return or Space||Enter or Space|
|Cycle up and down through auto-complete suggestions (Rules view only, when a property or value is being edited)||Up arrow , Down arrow||Up arrow , Down arrow||Up arrow , Down arrow|
|Choose current auto-complete suggestion (Rules view only, when a property or value is being edited)||Enter or Tab||Return or Tab||Enter or Tab|
|Increment selected value by 1||Up arrow||Up arrow||Up arrow|
|Decrement selected value by 1||Down arrow||Down arrow||Down arrow|
|Increment selected value by 100||Shift + Page Up||Shift + Page Up||Shift + Page Up|
|Decrement selected value by 100||Shift + Page Down||Shift + Page Down||Shift + Page Down|
|Increment selected value by 10||Shift + Up arrow||Shift + Up arrow||Shift + Up arrow|
|Decrement selected value by 10||Shift + Down arrow||Shift + Down arrow||Shift + Down arrow|
|Increment selected value by 0.1||Alt + Up arrow (Ctrl + Up arrow from Firefox 60 onwards.)||Alt + Up arrow||Alt + Up arrow (Ctrl + Up arrow from Firefox 60 onwards.)|
|Decrement selected value by 0.1||Alt + Down arrow (Ctrl + Down arrow from Firefox 60 onwards).||Alt + Down arrow||Alt + Down arrow (Ctrl + Down arrow from Firefox 60 onwards).|
|Show/hide more information about current property (Computed view only, when a property is selected)||Enter or Space||Return or Space||Enter or Space|
|Open MDN reference page about current property (Computed view only, when a property is selected)||F1||F1||F1|
|Open current CSS file in Style Editor (Computed view only, when more information is shown for a property and a CSS file reference is focused).||Enter||Return||Enter|
These shortcuts work in all tools that are hosted in the toolbox.
|Increase font size||Ctrl + +||Cmd + +||Ctrl + +|
|Decrease font size||Ctrl + -||Cmd + -||Ctrl + -|
|Reset font size||Ctrl + 0||Cmd + 0||Ctrl + 0|