Summary of Chrome Developer tools usage

Source: Internet
Author: User
Tags list of attributes chrome developer chrome developer tools

Opening of developer tools

Right-click on the page and select the review element;

or open the Tools--developer Tools;

or open with a shortcut key Command Option + I ;

Then you'll see eight tools on top:

    1. Elements: Allows us to view the page from a browser's perspective, which means we can see the HTML, CSS, and Dom (Document object Model) objects required by Chrome to render the page. In addition, you can edit these content to change the page display effect;

    2. Network: You can see which resources the page has requested from the server, the size of the resources, and the time it takes to load the resources, and of course see which resources are not loaded successfully. In addition, you can also view the HTTP request header, return content, etc.;

    3. Sources: Mainly used for debugging JS;

    4. Timeline: Provides a complete analysis of the time spent loading the page, all events, from downloading resources to processing JavaScript, calculating CSS styles and other time spent in the Timeline;

    5. Profiles: Analyze the execution time and memory usage of Web application or page;

    6. Resources: Validation and editing of data in local caches (IndexedDB, Web SQL, cookies, application caches, Web Storage);

    7. Audits: Analyze the process of page loading, and then provide a solution to reduce page load time and improve response speed;

    8. Console: Displays various warnings and error messages, and provides the shell for interacting with documents and developer tools.

*dom= Document Object Model, which provides a platform-and language-independent way to access and modify the content and structure of a document. In other words, this is a common way of representing and working with an HTML or XML document.

The DOM is actually a document model that is described in an object-oriented manner. The DOM defines the objects that are required to represent and modify the document, the behavior and properties of those objects, and the relationships between those objects. You can think of the DOM as a tree representation of the data and structure on the page, although the page may not be implemented in this way.

Each element in the HTML <body>、<p> is a DOM node, for example, and all DOM nodes make up the DOM tree. We can completely think of the entire page as a DOM tree, and the HTML element tag as a DOM node.

After you select the DOM object, right-click to see some of the auxiliary features, which are visible at the top of the page:

    1. Add Attribute: Add a new attribute to the tag;

    2. Force Element State: Sometimes we add dynamic styles to the page elements, such as when the mouse hovers over the elements, and this dynamic style is difficult to debug. We can use Force Element State force element states to facilitate debugging, such as:

      ![图4. 强制元素状态][4]
    3. Edit as HTML: Changes the page element in HTML form;

    4. Copy XPath: copying XPath;

    5. Delete node: Deletes the DOM node;

    6. Break on: Sets the DOM breakpoint.

On the right is the CSS style diagram when the label is selected,

    • Styles: Displays user-defined styles, such as the styles in the requested Default.css, the styles generated through Javasript, and the styles added by the developer tools;

    • Computed: Displays the developer tools calculated element style;

    • Event Listeners: Displays all JavaScript event listeners for the current HTML DOM node and its ancestor nodes, where the listener script can come from a plugin from chrome. You can click the Small funnel shape (filter) on the right to select the event listener that displays only the current node.

    • Dom Breakpoints: Lists all the DOM breakpoints;

    • Properties: Super-comprehensive list of attributes for the current selection, but rarely used.

Use the style in general

The + sign in the figure is to New style rule add a new selector for the current label, and the newly created style is Inspector-stylesheet. In addition, it can be added and modified directly in the original style.

On the right side of the new style rule, select Toggle Element State the selection box that appears, and if selected :hover , you can see the CSS style when the mouse hovers over the page element, similar to the previous force Element Satte, and more can be seen: hover State in Chrome Developer Tools .

Summary of Chrome Developer tools usage

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.