Throughout this session, you will discover:
- How to form and implement categories
- How to adjust categories
- How to delete a category
- How to replicate a category
- How to craft combination categories
- How to establish a global category
How to forge and apply categories
At the instant you commence styling an element, a category is spontaneously generated and implemented to the chosen element. All style modifications made on this element are retained in this category.
To initiate a category:
- Pick an element on the canvas
- Input the Designator field and define your category
That’s it — you’ve formulated a category!
You can also manually initiate a category before integrating styles by typing a category name in the Designator field.
There are 3 methods to reach the Designator field:
- Accessing the designator field in the Style Panel
- Using Command + Enter (on Mac) or Control + Enter (on Windows) keyboard shortcuts
- Right-clicking the element and selecting Insert category in the context menu
To implement the same category to as many elements as desired:
- Choose the element on the canvas
- Type the category name in the Designator field
- Hit Enter
As you start typing a category name in the Designator, you can observe the category name emerge in the Designator drop-down list. You can opt for the category by selecting the name or by navigating to it with keyboard arrows and pressing Enter.
How to modify categories
After a category has been established and implemented to various elements, you can alter that category.
To modify a category:
- Select any element with that category
- Adjust your styling
Any style modifications will influence all occurrences where that category is employed across the site.
A category is provided a unique name based on the element type, but you have the liberty to rename it.
There are 4 approaches to rename a category:
- Double-tap the category name in the Designator, rename it, and press Enter
- Press Command + Shift + Enter, rename the category, and press Enter
- Right-click the element, opt for Rename category, rename the class, and press Enter
- Hover over the category name in the Designator, click the drop-down that emerges, select Rename category, rename the category, press Enter
The new name will be displayed in the Design manager and the Designator in the Style panel.
You can also rename a category in the Design manager.
Top practices for CSS naming:
- Category names are case-insensitive (“alert” is equivalent to “ALERT”)
- Category names must start with a letter
- Category names should utilize an alphanumeric format (a-z and 0-9) and hyphens, and should evade special characters
Pro tip: When naming categories, it’s advisable to apply hyphens as logical grouping separators (tab-menu) and offer categories specific names based on their operation, not their style. Good: form-button. Bad: blue-button.
Unique characters in category names
A unique character is a character that diverges from alphabetic or numeric characters. Punctuation marks and other symbols serve as instances of unique characters.
While you can include most unique characters in a category name (e.g., your category name +), it’s not endorsed because Webflow automatically alters the unique character to a hyphen.
For instance, a category named your category name + would be treated precisely the same as a category labeled your category name $ because both the + and $ unique characters will be converted to a hyphen: (e.g., your category name –).
In the cited scenario, any style alterations to the two separate categories utilizing the unique characters would subsequently apply to both.
How to erase a category
If you aspire to apply a different category to an element that already possesses a category, you can eliminate the existing category in 2 manners:
- Input the Designator field and press Delete on your keyboard
- Hover over the category, tap the downward arrow, and select Remove category
Method for replicating a class
You have the option to replicate and adjust a class without modifying your original class.
To create a copy of an existing class:
- Hover your mouse pointer over the class
- Select the downward-facing arrow
- Choose Duplicate Class
- Give the class a new name and hit Enter
Important: A duplicated class constitutes a fresh class that is independent from the original one — modifications no longer carry over to the duplicated class.
Technique to establish a combo class
Following the application of a class to an element and the addition of styling, you may want to implement a minor styling adjustment on a particular instance of this class while not affecting other elements with the same class. Instead of crafting a new class and replicating the same styles, Webflow facilitates the creation of what we refer to as a combo class, allowing you to introduce style overrides to craft a unique variation.
You can append combo classes to elements by entering a new class name in the Selector field right adjacent to the base class.
You can access the Selector in 3 different manners:
- Selecting the Selector field, located next to the existing class
- Pressing Command + Enter (on Mac) or Control + Enter (on Windows)
- Right-clicking the element and opting for Add class in the context menu
Any class subsequent to the initial base class is recognized as a combo class. As the combo class has solely been added to the chosen element, any style modifications applied to this element will not affect other occurrences of the base class.
Technique for applying a combo class
If you want another element to possess the same base class and combo class, you can apply these classes consecutively — first apply the base class and then apply the combo class.
Keyboard shortcuts: When entering a class name in the Selector field, typing a comma will include that class and enable you to swiftly input the subsequent combo class without needing to refocus on the Selector field.
Approach to overriding styles
Upon generating a combo class, you can introduce new styles or override styles inherited from the base class. The modifications will solely impact the combo class.
Within the Style panel, inherited styles are denoted in orange, while overridden or fresh styles will be highlighted in blue.
Approach to modifying the base class
While styling an element with a combo class, all style adjustments solely affect the combo class because the combo class serves as a more specific selection. When you wish to style the primary, base class, you can access it through the inheritance menu positioned above the selector:
- Click on the inheritance selectors indicator above the Selector field
- Choose the base class
- Implement your styling changes
- Hit Back above the Selector to revert to styling the combo class
All alterations made to the base class will be reflected across all elements where that base class is applied, including the chosen element with the combo class.
Hit Back above the selector to switch back to styling the combo class
Certain styling changes to the base class may not be visible on the combo class if you have already styled that same property on the combo class. This is because the value will be overridden by the combo class. These styles are indicated by a red strikethrough.