18

Is it possible to add new CSS properties in the Chrome inspector? It seems that you can only edit existing properties.

Also, once you edit the properties, is there a way to view the revised CSS as a whole?

thirtydot
  • 224,678
  • 48
  • 389
  • 349
ina
  • 19,167
  • 39
  • 122
  • 201

4 Answers4

19

Yes, it's possible to add new CSS properties in the Chrome inspector and review them in a few easy steps:

  1. Right click in the element you want to change and choose "Inspect element";
  2. Click the "New Style Rule" button (1 in the image below);
  3. Google Chrome will assign a CSS matching rule which you can rename (2 in the image below);
  4. Add your CSS rules (2 in the image below);
  5. When you're done just check the "Computed Style" pane (3 in the image below).

Add new CSS properties in the Chrome inspector

Rolando Isidoro
  • 4,983
  • 2
  • 31
  • 43
7

You can add new property in a rule double clicking within the rule. Also you can add a new rule from the wheel in the corner and then select "New Style Rule".

To view the whole revised document go to: Resources > Frame > site name > Stylesheets > stylesheet-name.css

Or simply Click the + symbol above the css properties

Community
  • 1
  • 1
Sotiris
  • 38,986
  • 11
  • 53
  • 85
4

Is it possible to add new CSS properties in the Chrome inspector? It seems that you can only edit existing properties...

Simply double-click in any white and empty space in the "Styles" panel.

I tend to double-click to the right of the } for whichever CSS rule I want to edit.

Also, once you edit the properties, is there a way to view the revised CSS as a whole?

See @Sotiris's answer.

Not that I know of.

There may be an extension that can do this, but if one exists, it probably won't preserve the exact formatting of your original CSS.

Community
  • 1
  • 1
thirtydot
  • 224,678
  • 48
  • 389
  • 349
  • 1
    You've probably just saved me 17 hours a year - I never thought to click the closing `}`. I tend to double click the last property and then tab to create a new one. – alexmuller Jul 12 '11 at 09:20
2

Why not? Here is the screenshot of the Styles panel of the Google Chrome inspector Google Chrome inspector

Notice the block:

element.style {

}

You just click with mouse in that area and inspector will give you an opportunity to add new styles. If you need to add a new attribute to an element, you right click on it in the Elements panel and choose 'Add attribute'.

Also, once you edit the properties, is there a way to view the revised CSS as a whole?

Doesn't Computed Style panel give you this information? There you can check al lthe styles applied to a node and, actually, in what rule and from what stylesheet they are applied.

spliter
  • 12,321
  • 4
  • 33
  • 36