How do I add a new class with a ::before style to each element in Webflow?

Published on
September 22, 2023

To add a new class with a ::before style to each element in Webflow, you can follow these steps:

  1. Select the element: Identify the element on your Webflow canvas or in the Navigator panel that you want to add the ::before style to.

  2. Open the class manager: In the Style panel on the right-hand side, click on the class name under the Element Settings section to open the class manager.

  3. Create a new class: In the class manager, click on the "+ New Class" button to create a new class.

  4. Assign the new class: With the new class selected in the class manager, click on the "+" icon next to "Selectors" to add a new selector.

  5. Add the ::before pseudo-element: In the selector field, enter the desired selector for the element(s) you want to target. For example, if you want to target all <div> elements, enter div as the selector.

  6. Style the ::before pseudo-element: In the Style panel, select the ::before pseudo-element from the "Selector" dropdown menu. This will allow you to style the ::before pseudo-element separately from the main element.

  7. Customize the style: Adjust the properties and values to define the ::before style, such as background, content, position, etc. You can set these properties using the options available in the Style panel or by manually entering CSS code in the custom code field.

  8. Apply changes: Once you're satisfied with the ::before style, click outside of the class manager or press Enter to apply the changes. The new class with the ::before style will be added to the element and will affect all elements with the same selector(s).

By following these steps, you can easily add a new class with a ::before style to each element in Webflow, allowing you to customize and enhance your website design.

Additional questions:

  1. How do I create a new class in Webflow?
  2. How can I style a pseudo-element in Webflow?
  3. What is the difference between a class and a pseudo-element in Webflow?