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
From Firefox 35 onwards, you can inspect pseudo-elements added using
Element popup menu
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
Open the split console and enter the console command "
|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
When you create a CSS animation you can specify a timing function: this determines the rate at which the animation progresses. One way to specify the timing function is with a cubic Bézier curve.
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."
|Open the Inspector||Ctrl + Shift + C||Cmd + Opt + C||Ctrl + Shift + C|
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|
|Expand currently selected node||Right arrow||Right arrow||Right arrow|
|Collapse currently selected node||Right arrow||Right arrow||Right arrow|
|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|
|Start editing the selected attribute||Enter||Enter||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|
These shortcuts work when you're in the Inspector's CSS pane.
|Step forward through properties and values||Tab||Tab||Tab|
|Step backwards through properties and values||Shift + Tab||Shift + Tab||Shift + Tab|
|Increment selected value by one||Up arrow||Up arrow||Up arrow|
|Decrement selected value by one||Down arrow||Down arrow||Down arrow|
|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||Opt + Up arrow||Alt + Up arrow|
|Decrement selected value by 0.1||Alt + Down arrow||Opt + Down arrow||Alt + Down arrow|
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|