Chrome Developer Tools: Elements panel

Source: Internet
Author: User
Tags chrome developer chrome developer tools

Note: This article describes five articles translated by Chrome Developer Tools.

See https://developers.google.com/chrome-developer-tools/docs/elements for more information

Chrome Developer Tools: Elements panel ElementsPanel

TheElementsPanel lets you see everything in one DOM tree, and allows inspection and on-the-fly editing of DOM elements. you will often visit the elements tabs when you need to identify the HTML snippet for some aspect of the page. for example, you may be curious if an image has an html id attribute, and what that attribute's value is.

ElementsThe Panel allows you to see everything in the DOM tree and allows you to view and modify DOM elements online. When you need to identify some parts of the page, you will frequently access the elements tab. For example, if an image has an html id attribute, what is the attribute value.

The elements panel is sometimes a better way to "View Source" for a page. inside the elements panel, the page's Dom will be nicely formatted, easily showing you HTML elements, their ancestry and their descendants. too often, pages you visit will have minified or simply uugly HTML which makes it hard to see how the page is structured. the elements panel is your solution for viewing the real underlying structure of the page.

ElementsPanel is sometimes a better way to "view source code" on the page ". InElementsPanel, the page Dom will be well formatted, and it is easier to display your HTML elements, their ancestors and descendants. More often, the page you visit is too small or too simple and ugly, making it hard to see the structure of the page.ElementsPanel is the way to see the real underlying structure of the page.

Follow the steps below to release eElementsPanel:

Follow these steps to exploreElementsPanel

  • Open the Google closure hovercard demo page.
Open google closure hovercard demo page
  • Open the Developer Tools window as described in the how to access the Developer Tools section.
Open the developer tool window as described in how to access the developer tools.
  • If it is not already selected, selectElements.
If it is not selected, select elements.
  • This shows the page's HTML elements in the main pane, and styles, metrics, properties, and event listeners in the right-hand sidebar. if Developer Tools opened via the inspect element action, it is automatically drilled down to and highlighted the element under mouse. this is very useful when you are curious which HTML generated a participant page element.
The HTML elements of the page are displayed in the main pane, and the style, measurement, attribute, and event listening pane are displayed in the right pane. If the developer tool is opened by viewing the elements, it will automatically go deep and highlight the elements under the mouse. It is useful when you are curious about what HTML generates this page element. DOM elements tree

Elements tree, including its inline scripts and styles are syntax highlighted. For example, select<script>Tag. You shoshould see something like the following:

The element tree, including its internal scripts and styles, is highlighted. For example, if you select the <SCRIPT> tag, you will see the following interface:

 

Select<p>Element in the main window, you shoshould see something like this:

Select the <p> label in the main window and you will see the following interface:

This lets you add, edit, or delete attributes for the selected Dom element-<p>Element currently has no attributes. typing or pasting in attributes on the highlighted lines adds them to the DOM element. Deleting text deletes the attribute.

This allows you to add, edit, or delete attributes of the selected Dom element. The current <p> element has no attribute. Enter or paste the attribute to the DOM element in the highlighted row. Delete text deletion attributes.

  • You can edit node attributes in the main pane via double clicking them or pressingEnterKey while on an element.TabWill iterate over the Editable attributes.
You can double-click a node in the main pane or press enter to edit the node attributes. The tab key traverses editable attributes.
  • You can delete selected nodes usingDelKey.
You can use the Del key to delete the selected node.
  • You can drag-and-drop an element to change its position within its parent, or even move the element to a different parent.
You can drag and drop an element to change its position.

 

Back to Top

CSS styles

The cascading nature of CSS makes the styles browser in the elements tab very useful. sometimes, Styles collapse onto themselves and unintended events als appear. knowing which styling rule the browser is applying to the element helps you debug such an issue.

CSS cascade makes browsing style very useful on the elements tab. Sometimes, style collapse itself is visually displayed unconsciously. Knowing the style rules used by the browser for elements helps you debug problems.

Click the magnifying glass icon to turn on inspect mode. return to the Google closure hovercard page and click the top-left card, Tom Smith. because you are in inspect mode, this highlights the corresponding node inElementsPanel and displays its associated styles, then turns off inspect mode.

Click the magnifier icon to open the view mode. Return to the Google closure hovercard page and click the card on the top left, Tom Smith. Because you are in view mode, it is inElements panelHighlighted ElementAnd display its related mode, and then disable the view mode.

 

You'll see that we're re able to tell all the style attributes that are being applied. For example, the padding comes directly from<span>Element'sclass == anchorAttribute. The font is first definedbody, But then overriden by.anchor. There is alsofontProperty specified that is not recognized by the rendering engine. properties like this are marked with the triangle warning sign to the left.

You will see that we can identify all the style attributes that are being used. For example, padding directly comes from<span>The anchor class attribute of the element. The font is first defined for the body, but is overwritten by anchor. Also, the font attribute details are not recognized by the rendering engine. This attribute is marked on the left with an exclamation mark.

While it's great to see the individual styles and where they come from, it's also very useful to see the final set of styles after it is computed and applied to the element. you can see the final product by selectingComputed StyleSection and detail e styles as rendering engine perceives them.

We are very happy to see the independent styles and Their coming from there. This is very useful for seeing the final style that is computed and applied to the element. You can selectView what the browser rendering engine understands in the computed style section.FinalStyle.

Now, hover over. AnchorEditable style rule in the sidebar to see checkboxes that let you disable individual properties. You shoshould see something like this:

The. Anchor editable style on the sidebar is displayed. Disable an attribute. You can see something like this

You can disable a property by de-selecting it. you can disable the property by unselecting it.

 

Click an editable (non-grayed-out) style property name or value to edit them. For example, double-clickMargin: 20pxProperty. You shoshould see something like this:

Click the name or value of the Editable style attribute to edit them. For example, double-clickThe margin: 20px attribute is displayed as follows:

Autocompletion suggestions will appear while editing property names and values. to add a new style property, click anywhere in the Editable style declaration whitespace. the new property will be added immediately after the clicked style declaration. if you edit a style property value with a number, you can useUpOrDownKeys to change the number. HoldingALT/OptionKey steps by 0.1, holdingShiftKey steps by 10. you can add more properties via double-clicking white area to the left/bottom of existing entries or via pasting multiple properties separated with semicolon. you can start editing of style rule selectors by clicking them. you can also add new style rules usingGear menu, Located to the right of the styles section bar. When editing the attribute name and value, the auto-completion suggestions are displayed. Click any position in the Editable style declaration blank to add a new style value. After you click style declaration, the new attribute is added immediately. If you edit a style property value as a number, you can use the up or down key to change the number. Press and hold the alt/option key, change 0.1 each time, and press and hold the Shift key for 10 changes each time. You can add more properties by double-clicking the white area on the left or bottom or by pasting multiple row attributes separated by semicolons. You can click the style rule selector to edit the rule. You can also useGearAdd a new style to the menu.

You can add a new style selector using the button found inStylesSection Bar. in order to emulate an element's pseudo State (: active,: hover,: focus,: visited), use the in the styles pane header. in will bring up a small pane where you can select which pseudo dostates of the selected element shoshould be activated.

You can find a new style selector in the styles area. You can use the style pane header to simulate the pseudo State of an element. A small panel is displayed, and you can select the pseudo State of the selector to be activated.

Back to Top

Box Model

OpenMetricsPane in the right-hand side-bar, then double-click one of the metrics values.

In the right sidebar, open the measurement pane, and double-click a measurement value.

This lets you edit any of the absolute, relative, or fixed CSS Box Model Metrics. This lets you edit any absolute, relative, or fixed CSS box model metric values.

 

Properties property value

SelectPropertiesPane in the right-hand sidebar, then expandElement.

Select the attribute pane in the right sidebar and expand the element.

From here you can edit the element's Dom properties. Deleting all the text deletes the property, if allowed. From here, you can edit the element of the DOM attribute. If allowed, delete all text deletion attributes. Dom breakpoints

You can add breakpoints that fire on Dom modifications related to a certain element. bring up a context menu on the # profilecard element and select the events you want to break on: subtree modifications, attributes modifications, and the node removal. let's select "attributes modification" for now. mover your mouse over any gray rectangle with a name. your JavaScript code will break inside tooltip. js which tries to modify the "classname" attribute of the # profilecard element. press F8 to continue the Javascript execution. the Code immediately breaks on an Attribute Modification once again. now select Dom breakpoints in the right-hand sidebar.

You can increase the breakpoint, which is triggered when the DOM of a related element changes. The context menu appears on the # profilecard element. Select the event you want to abort, modify the subtree, modify the attributes, and remove the node. Now let's select attribute modification. Move your mouse over the task gray box name. Your JavaScript code will be interrupted in tooltip. js and it tries to modify the class name of # profilecard. Press F8 to continue executing JavaScript. The code is immediately interrupted in the Attribute Modification area. Now select Dom breakpoint in the right sidebar.

You will see a list of your dom breakpoints (contains a single breakpoint you just added .) you can toggle the breakpoint using a nearby checkbox to de-activate (and re-activate) it, or you can remove it altogether using its context menu's "Remove breakpoint" item.

You will see a system Dom breakpoint (including a breakpoint you just added .) You can unactivate or reactivate a breakpoint by marking the check box next to the breakpoint, or you can remove it by right-clicking "Remove breakpoint" in the menu.

 

Event Listeners event listening

SelectEvent ListenersIn the right-hand sidebar.

SelectEvent Listeners 

The Event Listeners shown for the selected node are in the order in which they are fired through the capturing and bubbling phases. this provides the most accurate and useful information possible. event Listeners are separated by type. if a node has bothOnclickAndOnmouseoverListeners they appear in different sections. You can also set your filter preference usingGear menu. You can choose to see only the listeners registered on the selected node, or the entire event flow. The event listener displays the selected nodes, which are triggered during the capture or bubble phase. This provides the most accurate and useful information possible. Event Listeners are separated by type. If a node has a click and a mouse over the listener, they are displayed in different areas. You can set your filter preferences in the gear menu. You can choose to see only the listener registered to the selected node or the entire event process.

 

Search

TypeDocument. WriteIn the search box. You shoshould see incremental search running:

Enter in the search boxDocument. Write, you can see the incremental search run:

In addition, press enter in the search box to go to the next search item.

TheElementsPanel supports XPath and CSS selectors as queries, in addition to plain text. All search results are highlighted in the DOM tree, the first match is revealed and selected.In addition to plain text, the elements Panel also supports XPath and CSS selector as search requests. All search structures are highlighted on the DOM tree, and the first matched reversed color is selected.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.