Overview Open Chrome DevTools What's New in DevTools DevTools tips Simulate mobile devices with Device Mode Performance insights: Get actionable insights on your website's performance Lighthouse: Optimize website speed Animations: Inspect and modify CSS animation effects Changes: Track your HTML, CSS, and JavaScript changes Coverage: Find unused JavaScript and CSS CSS Overview: Identify potential CSS improvements Issues: Find and fix problems Media: View and debug media players information Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView, and Wasm Memory. Network conditions: Override the user agent string Security: Understand security issues Search: Find text across all loaded resources Sensors: Emulate device sensors WebAuthn: Emulate authenticators Customize DevTools Engineering blog
Overview Open Chrome DevTools What's New in DevTools DevTools tips Simulate mobile devices with Device Mode Performance insights: Get actionable insights on your website's performance Lighthouse: Optimize website speed Animations: Inspect and modify CSS animation effects Changes: Track your HTML, CSS, and JavaScript changes Coverage: Find unused JavaScript and CSS CSS Overview: Identify potential CSS improvements Issues: Find and fix problems Media: View and debug media players information Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView, and Wasm Memory. Network conditions: Override the user agent string Security: Understand security issues Search: Find text across all loaded resources Sensors: Emulate device sensors WebAuthn: Emulate authenticators Customize DevTools Engineering blog

CSS features reference

Published on Updated on

Discover new workflows in this comprehensive reference of Chrome DevTools features related to viewing and changing CSS.

See View and change CSS to learn the basics.

Select an element

The Elements panel of DevTools lets you view or change the CSS of one element at a time.

An example of a selected element.

The h1 element that's highlighted blue in the DOM Tree above is the selected element. To the right, the element's styles are shown in the Styles pane. To the left, the element is highlighted in the viewport, but only because the mouse is currently hovering over it in the DOM Tree.

See View an element's CSS for a tutorial.

There are many ways to select an element:

  • In your viewport, right-click the element and select Inspect.
  • In DevTools, click Select an element Select an element or press Command+Shift+C (Mac) or Control+Shift+C (Windows, Linux), and then click the element in the viewport.
  • In DevTools, click the element in the DOM Tree.
  • In DevTools, run a query like document.querySelector('p') in the Console, right-click the result, and then select Reveal in Elements panel.

View CSS

View CSS documentation

To see a tooltip with a short CSS description, hover over the property name in the Styles pane.

DevTools pulls the descriptions for tooltips from VS Code Custom Data.

The tooltip with documentation on a CSS property.

Click Learn more to go to an MDN CSS Reference on this property.

To turn the tooltips off, check Checkbox. Don't show.

To turn them back on, check Settings. Settings > Preferences > Elements > Checkbox. Show CSS documentation tooltip.

View invalid, overridden, inactive, and other CSS

The Styles pane recognizes many kinds of CSS issues and highlights them in different ways.

See Understand CSS in the Styles pane.

View the external stylesheet where a rule is defined

In the Styles pane, click the link next to a CSS rule to open the external stylesheet that defines the rule.

Viewing the stylesheet where a rule is defined

If the stylesheet is minified, see Make a minified file readable.

View only the CSS that's actually applied to an element

The Styles pane shows you all of the rules that apply to an element, including declarations that have been overridden. When you're not interested in overridden declarations, use the Computed tab to view only the CSS that's actually being applied to an element.

  1. Select an element.
  2. Go to the Computed pane in the Elements panel.
The Computed tab.

Check the Show All checkbox to see all properties.

See Understand CSS in the Computed pane.

View CSS properties in alphabetical order

Use the Computed pane. See View only the CSS that's actually applied to an element.

View inherited CSS properties

Check the Show All checkbox in the Computed pane. See View only the CSS that's actually applied to an element.

Alternatively, scroll down the Styles pane and find sections named Inherited from <element_name>.

View the Inherited from... section of the Styles pane.

View @supports at-rules

The Styles pane shows you the @supports CSS at-rules if they are applied to an element. For example, inspect the following element:

View @supports at-rules.

If your browser supports the lab() function, the element is green, otherwise it's purple.

Note: At the time of writing, only Safari supports the CIELAB color space.

View @scope at-rules

The Styles pane shows you CSS @scope at-rules if they are applied to an element.

The new @scope at-rules are a part of the CSS Cascading and Inheritance Level 6 specification. These rules allow you to scope CSS styles, in other words, explicitly apply styles to specific elements.

Note: The @scope at-rule feature is experimental. To test it, enable the Experimental Web Platform features flag in chrome://flags/#enable-experimental-web-platform-features. Otherwise, the preview below doesn't work.

View the @scope rule in the following preview:

  1. Inspect the text on the card in the preview.
  2. On the Styles pane, find the @scope rule.
The @scope rule.

In this example, the @scope rule overrides the global CSS background-color declaration for all <p> elements inside elements with a card class.

To edit the @scope rule, double-click it.

View an element's box model

To view the box model of an element, go to the Styles pane and click the Show sidebar. Show sidebar button in the action bar.

he Box Model diagram.

To change a value, double-click on it.

Search and filter an element's CSS

Use the Filter text box on the Styles and Computed panes to search for specific CSS properties or values.

Filtering the Styles pane.

To also search inherited properties in the Computed pane, check the Show All checkbox.

Filtering inherited properties in the Computed pane.

To navigate the Computed pane, group the filtered properties in collapsible categories by checking Group.

Grouping filtered properties.

Toggle a pseudo-class

To toggle a pseudo-class like :active, :focus, :hover, :visited, :focus-within or focus-visible:

  1. Select an element.
  2. On the Elements panel, go to the Styles pane.
  3. Click :hov.
  4. Check the pseudo-class that you want to enable.
Toggling the hover pseudostate on an element.

In the viewport, you can see that DevTools applies the background-color declaration to the element, even though the element is not actually hovered over.

See Add a pseudostate to a class for an interactive tutorial.

View inherited highlight pseudo-elements

Pseudo-elements let you style specific parts of elements. Highlight pseudo-elements are document portions with a "selected" status and they are styled as "highlighted" to indicate this status to the user. For example, such pseudo-elements are ::selection, ::spelling-error, ::grammar-error, and ::highlight.

As mentioned in the specification, when multiple styles conflict, cascade determines the winning style.

To enable this feature, run Chrome with the --enable-blink-features=HighlightInheritance flag.

To better understand the inheritance and priority of the rules, you can view the inherited highlight pseudo-elements:

  1. Inspect the text below.

    I inherited the style of my parent's highlight pseudo-element. Select me!
  2. Select a portion of the text above.

  3. In the Styles pane, scroll down to find the Inherited from ::selection pseudo of... section.

View the Inherited section of the Styles pane.

View cascade layers

Cascade layers enable more explicit control of your CSS files to prevent style-specificity conflicts. This is useful for large codebases, design systems, and when managing third-party styles in applications.

To view cascade layers, inspect the element below and open Elements > Styles.

In the Styles pane, view the 3 cascade layers and their styles: page, component and base.

Cascade layers.

To view the layer order, click the layer name or the Toggle layers. Toggle CSS layers view button.

The page layer has the highest specificity, therefore the element's background is green.

To view a page in print mode:

  1. Open the Command Menu.
  2. Start typing Rendering and select Show Rendering.
  3. For the Emulate CSS Media drop-down, select print.

View used and unused CSS with the Coverage tab

The Coverage tab shows you what CSS a page actually uses.

  1. Press Command+Shift+P (Mac) or Control+Shift+P (Windows, Linux, ChromeOS) while DevTools is in focus to open the Command Menu.

  2. Start typing coverage.

    Opening the Coverage tab from the Command Menu.
  3. Select Show Coverage. The Coverage tab appears.

    The Coverage tab.
  4. Click Start Instrumenting Coverage And Reload Page. Reload. The page reloads and the Coverage tab provides an overview of how much CSS (and JavaScript) is used from each file that the browser loads.

    An overview of how much CSS (and JavaScript) is used and unused.

    Green represents used CSS. Red represents unused CSS.

  5. Click a CSS file to see a line-by-line breakdown of what CSS it uses in the preview above.

    A line-by-line breakdown of used and unused CSS.

    On the screenshot above, lines 55 to 57 and 65 to 67 of devsite-google-blue.css are unused, whereas lines 59 to 63 are used.

Force print preview mode

See Force DevTools Into Print Preview Mode.

Copy CSS

From a single drop-down menu in the Styles pane, you can copy separate CSS rules, declarations, properties, values

Additionally, you can copy CSS properties in JavaScript syntax. This option is handy if you're using CSS-in-JS libraries.

To copy CSS:

  1. Select an element.

  2. In the Elements > Styles pane, right-click a CSS property. Copy CSS drop-down menu.

  3. Select one of the following options from the drop-down menu:

    • Copy declaration. Copies the property and its value in CSS syntax:
      property: value;
    • Copy property. Copies only the property name.
    • Copy value. Copies only the value.
    • Copy rule. Copies the entire CSS rule:
      selector[, selector] {
      property: value;
      property: value;
      ...
      }
    • Copy declaration as JS. Copies the property and its value in JavaScript syntax:
      propertyInCamelCase: 'value'
    • Copy all declarations. Copies all properties and their values in the CSS rule:
      property: value;
      property: value;
      ...
    • Copy all declarations as JS. Copies all properties and their values in JavaScript syntax:
      propertyInCamelCase: 'value',
      propertyInCamelCase: 'value',
      ...
    • Copy all CSS changes. Copies the changes you make in the Styles pane across all declarations.
    • View computed value. Takes you to the Computed pane.

Change CSS

Add a CSS declaration to an element

Since the order of declarations affects how an element is styled, you can add declarations in different ways:

What workflow should you use? For most scenarios, you probably want to use the inline declaration workflow. Inline declarations have higher specificity than external ones, so the inline workflow ensures that the changes take effect in the element as you'd expect. See Selector Types for more on specificity.

If you're debugging an element's styles and you need to specifically test what happens when a declaration is defined in different places, use the other workflow.

Add an inline declaration

To add an inline declaration:

  1. Select an element.
  2. In the Styles pane, click between the brackets of the element.style section. The cursor focuses, allowing you to enter text.
  3. Enter a property name and press Enter.
  4. Enter a valid value for that property and press Enter. In the DOM Tree, you can see that a style attribute has been added to the element.
Adding inline declarations.

On the screenshot above, the margin-top and background-color properties have been applied to the selected element. In the DOM Tree you can see the declarations reflected in the element's style attribute.

Add a declaration to a style rule

To add a declaration to an existing style rule:

  1. Select an element.
  2. In the Styles pane, click between the brackets of the style rule to which you want to add the declaration. The cursor focuses, allowing you to enter text.
  3. Enter a property name and press Enter.
  4. Enter a valid value for that property and press Enter.
Changing the value of a declaration.

On the screenshot above, a style rule gets the new border-bottom-style:groove declaration.

Change a declaration name or value

Double-click a declaration's name or value to change it. See Change enumerable values with keyboard shortcuts for shortcuts for quickly incrementing or decrementing a value by 0.1, 1, 10, or 100 units.

Change enumerable values with keyboard shortcuts

While editing an enumerable value of a declaration, for example, font-size, you can use the following keyboard shortcuts to increment the value by a fixed amount:

  • Option+Up (Mac) or Alt+Up (Windows, Linux) to increment by 0.1.
  • Up to change the value by 1, or by 0.1 if the current value is between -1 and 1.
  • Shift+Up to increment by 10.
  • Shift+Command+Up (Mac) or Control+Shift+Page Up (Windows, Linux) to increment the value by 100.

Decrementing also works. Just replace each instance of Up mentioned above with Down.

Change length values

You can use your pointer to change any property with length, such as width, height, padding, margin, or border.

To change the length unit:

  1. Hover over the unit name and notice that it's underlined.

  2. Click on the unit name to select a unit from the drop-down.

To change the length value:

  1. Hover over the unit value and notice that your pointer changes to a horizontal double-headed arrow.

  2. Drag horizontally to increase or decrease the value.

To adjust the value by 10, hold Shift when dragging.

Add a class to an element

To add a class to an element:

  1. Select the element in the DOM Tree.
  2. Click .cls.
  3. Enter the name of the class in the Add New Class text box.
  4. Press Enter.
The Element Classes pane.

Emulate light and dark theme preferences and enable automatic dark mode

To toggle automatic dark mode or emulate the user's preference of light or dark themes:

  1. On the Elements > Styles pane, click Toggle common rendering emulations.Toggle common rendering emulations. Toggle common rendering emulations.

  2. Select one of the following from the drop-down list:

    • prefers-color-scheme: light. Indicates that the user prefers the light theme.
    • prefers-color-scheme: dark. Indicates that the user prefers the dark theme.
    • Automatic dark mode. Displays your page in dark mode even if you didn't implement it. Additionally, sets prefers-color-scheme to dark automatically.

This drop-down is a shortcut for Emulate CSS media feature prefers-color-scheme and Enable automatic dark mode options of the Rendering tab.

Toggle a class

To enable or disable a class on an element:

  1. Select the element in the DOM Tree.
  2. Open the Element Classes pane. See Add a class to an element. Below the Add New Class text box are all of the classes that are being applied to this element.
  3. Toggle the checkbox next to the class that you want to enable or disable.

Add a style rule

To add a new style rule:

  1. Select an element.
  2. Click New Style Rule New Style Rule.. DevTools inserts a new rule beneath the element.style rule.
Adding a new style rule.

On the screenshot above, DevTools adds the h1.devsite-page-title style rule after clicking New Style Rule.

Choose which stylesheet to add a rule to

When adding a new style rule, click and hold New Style Rule New Style Rule. to choose which stylesheet to add the style rule to.

Choosing a stylesheet.

Toggle a declaration

To toggle a single declaration on or off:

  1. Select an element.
  2. In the Styles pane, hover over the rule that defines the declaration. Checkboxes appear next to each declaration.
  3. Check or uncheck the checkbox next to the declaration. When you uncheck a declaration, DevTools crosses it out to indicate that it's no longer active.
Toggling a declaration.

On the screenshot above, the color property for the currently-selected element is toggled off.

Align grid items and their content with the Grid Editor

See the corresponding section in Inspect CSS grid.

Change colors with the Color Picker

See Inspect and debug HD and non-HD colors with the Color Picker.

Change angle value with the Angle Clock

The Angle Clock provides a GUI for changing <angle>s in CSS property values.

To open the Angle Clock:

  1. Select an element with angle declaration. For example, select the text below.

  2. In the Styles pane, find the transform or background declaration that you want to change. Click on the Angle Preview box next to the angle value.

    Angle preview.

    The small clocks to the left of -5deg and 0.25turn are the angle previews.

  3. Click the preview to open the Angle Clock.

    Angle clock.
  4. Change the angle value by clicking on the Angle Clock circle or scroll your mouse to increase / decrease the angle value by 1.

  5. There are more keyboard shortcuts to change the angle value. Find out more in the Styles pane keyboard shortcuts.

Change box and text shadows with the Shadow Editor

The Shadow Editor provides a GUI for changing text-shadow and box-shadow CSS declarations.

To change shadows with the Shadow Editor:

  1. Select an element with a shadow declaration. For example, select the element below.

  2. In the Styles pane, find a shadow Shadow. icon next to the text-shadow or box-shadow declaration.

    Shadow icons.
  3. Click the shadow icon to open the Shadow editor.

    Shadow editor.
  4. Change the shadow properties:

    • Type (only for box-shadow). Pick Outset or Inset.
    • X and Y offsets. Drag the blue dot or specify values.
    • Blur. Drag the slider or specify a value.
    • Spread (only for box-shadow). Drag the slider or specify a value.
  5. Observe the changes applied to the element.

Edit animation and transition timings with the Easing Editor

The Easing Editor provides a GUI for changing the easing values of transition-timing-function and animation-timing-function.

To change the values with the Easing Editor:

  1. Select an element with a timing function declaration, like the <body> element on this page.
  2. In the Styles tab, find the purple Ease. icon next to the transition-timing-function or animation-timing-function declarations. Ease icon.
  3. Click the icon to open the Easing Editor: The Easing Editor.
  4. To set a keyword value, click one of the picker buttons:
    • ease-in-out The ease-in-out button.
    • ease-in The ease-in button.
    • ease-out The ease-out button.
  5. In the Presets switcher, click Left. or Right. buttons to pick one of the following presets:
Easing typePresetBezier equivalent
ease-in-outIn Out, Sinecubic-bezier(0.45, 0.05, 0.55, 0.95)
In Out, Quadraticcubic-bezier(0.46, 0.03, 0.52, 0.96)
In Out, Cubiccubic-bezier(0.65, 0.05, 0.36, 1)
Fast Out, Slow Incubic-bezier(0.4, 0, 0.2, 1)
In Out, Backcubic-bezier(0.68, -0.55, 0.27, 1.55)
ease-inIn, Sinecubic-bezier(0.47, 0, 0.75, 0.72)
In, Quadraticcubic-bezier(0.55, 0.09, 0.68, 0.53)
In, Cubiccubic-bezier(0.55, 0.06, 0.68, 0.19)
In, Backcubic-bezier(0.6, -0.28, 0.74, 0.05)
Fast Out, Linear Incubic-bezier(0.4, 0, 1, 1)
ease-outOut, Sinecubic-bezier(0.39, 0.58, 0.57, 1)
Out, Quadraticcubic-bezier(0.25, 0.46, 0.45, 0.94)
Out, Cubiccubic-bezier(0.22, 0.61, 0.36, 1)
Linear Out, Slow Incubic-bezier(0, 0, 0.2, 1)
Out, Backcubic-bezier(0.18, 0.89, 0.32, 1.28)

Alternatively, in the Curve editor, drag the purple circles to set a custom cubic-bezier(x1,y1,x2,y2) value.

Curve editor.

Any change triggers a ball animation in the Preview at the top of editor.

(Experimental) Copy CSS changes

To enable this experimental feature, check Sync CSS changes in the Styles pane under Settings. Settings > Experiments and reload DevTools.

With this experiment enabled, the Styles pane highlights your CSS changes in green.

To copy a single CSS declaration change, hover over the highlighted declaration and click the Copy. Copy button.

Copy a CSS declaration change.

To copy all CSS changes across declarations at once, right-click on any declaration and select Copy all CSS changes.

Copy all CSS changes.

Additionally, you can track changes you make with the Changes tab.

Updated on Improve article

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.