Skip to content
pinegrow.com

Add or remove classes from elements

Let’s take a look at how you can add and remove classes (for example .my-class) from elements on the page.

On this page

In Pinegrow you can use multiple tools to do a single task. This is also true for editing classes. Choose the tool that best suits the task at hand:

Edit classes in Element Properties

Open the Element properties panel.

There you’ll find the Classes section with the list of all classes that are assigned to the selected element and the Add class button.

Classes section of the Properties panel for a div, listing the title-box, white and logo class chips with callouts for add, toggle and remove.
Classes section in Element properties panel.

Remove a class

Remove the class by clicking on the x icon 1.

Toggle the class (switch it on and off on the element) by clicking on its name 2.

Add a class

Add a class to the element by clicking on the Add class button 3.

This will open the Add classes tool:

Add classes tool

Add classes tool is a floating panel that lets you quickly add and remove classes from the selected elements.

Add Classes dialog for div.title-box with the search "title large-spacing", matching classes listed, and title-box, white and logo assigned.
Add classes tool.

You can use the tool to:

  • Type one or more class names 
    1 and press
    ENTER or click on Add button to assign the classes to selected elements. Use , or space to separate multiple class names.
  • Search the list of all known classes 
    2 in the project by typing in the same input box. Click on the class in the list to assign it to elements. Or use
    UP and
    DOWN keys to navigate the list and
    ENTER to confirm the selection.
  • Click on the class name in the
    Recent list
    3.
  • Toggle and remove assigned classes 
    4.

Shortcut Use CMD + L to open the Add classes tool.

Shortcut right click on the element and select Add classes from the menu.

Work with classes in Style panel

Style panel is used for styling page elements with CSS rules. But classes can be added and removed from there as well:

Using the rules context menu

Open the Style panel.

Right click on any rule that contains .class selector(s). The context menu contains commands for adding and removing such classes from the selected elements.

Style panel menu on the .title-box, .box, .logo-box rule offering to add the box or logo-box class to div.title-box or remove title-box.
Context menu of a rule with classes in selector.

Using Create CSS rule

Open the Style / Active panel.

Both “Quick create rule” 1 and “Create with selector maker” 2 tools have the option to add any classes mentioned in the new rule to the selected elements - if those classes are not assigned to the element already. 

Active style tab with .important-text in the selector field, the Create button, and the checked option to add that class to the element.
Create new CSS rule tool with option to add classes to elements.

NoteThis feature will not only add the class to the element but will also create a corresponding CSS rule for the class.

Edit class attribute

Open the Element properties panel.

There you’ll find the Attribute editor section:

Attribute Editor section of the Properties panel for a div, showing the class attribute set to title-box white logo and an Add attribute button.
Attribute editor in Element properties panel.

Add or edit the class attribute. Note that according to HTML specification multiple class names must be separated by a space character, not by a comma.

Edit element code

Open the Element code panel.

The element code panel shows the code of the selected element.

Edit the class attributes of the element in the HTML code:

HTML code panel with the selected div.title-box element's opening tag class="title-box white logo", with a callout reading "Edit the class attribute".
Element code editor.

Or switch to simplified Pug syntax 1 and edit classes prefixed by ‘.’ after the element tag name:

PUG code panel showing div.title-box.white.logo with its h1 child, with callouts for toggling the simplified mode and for editing classes.
Element code editor with simplified HTML syntax.