under construction WordPress Buttons are one of the most common interaction elements when it comes to websites. To improve design consistency and maintenance efficiency, the use of GenerateBlocks pro's Global Styles(The (Global Styles) feature helps you create a set of reusable, centrally manageable button styles.
This article will take you step by step through the process of creating, optimizing and reusing button styles.
![图片[1]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520093340879-image.png)
Why use Global Styles?
While traditional button styling needs to be manually adjusted on each page or module, GenerateBlocks Pro provides a global styling system that lets you set it once and reuse it in multiple places. Whether you need to create primary buttons, secondary buttons, or link buttons, all can be centrally managed and quickly maintained.
Second, create the first button style (Primary)
Step 1: Add the button element
- Edit any page or article
- Add button blocks for GenerateBlocks (click on the button element with the blue icon)
- Set the button's
displayattributeinline-flexTo avoid misdisplay in the editor
![图片[2]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094058830-image.png)
Step 2: Create Global Style
- Click "Create Style", it is recommended to use prefixed class name, such as
btn-primaryThe following are some of the most popular plug-ins in the world, reducing the probability of conflicts with other plug-ins
![图片[3]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094152292-image.png)
- Select "Start with blank"
![图片[4]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094233220-image.png)
Step 3: Setting Style Properties
- Background color: choose a dark brand color from the theme
![图片[5]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094347792-image.png)
- Border: 1px width, color matches the background
![图片[6]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094528912-image.png)
- Rounded corners: 100px, giving the appearance of rounded pill buttons
![图片[7]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094616601-image.png)
- Inner margins: top and bottom 1rem, left and right 2rem
- Text Style:
- Color: white
- Size: 1.125rem
- Word weight: 500
- Uppercase (Text Transform: Uppercase)
![图片[8]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094744474-image.png)
Step 4: Setting up the hover effect
- Click on the "Hover" tab to enter the hover state settings.
- Background color: change to a lighter shade of the same color
![图片[9]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520094846618-image.png)
- Border color: synchronously updated to light color to avoid visual conflict
![图片[10]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520095345219-image.png)
- Adding a shadow: generated using the box-shadow generator CSS Shadow code and paste
![图片[11]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520095135160-image.png)
- Add transition animation: set a 0.2 second transition effect for the button to make hovering more natural.
![图片[12]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520095225879-image.png)
Creating a reusable Box Shadow utility class
For ease of invocation, shadows can be set as a standalone style class
- New global style named
shadow-primary
![图片[13]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520095437675-image.png)
- Add Effect → Box Shadow → Paste Generator Code
![图片[14]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520095519539-image.png)
- Simply add the class name to the button to use the same shadow effect
IV. Examples of button style variants
1. Secondary button style (Secondary)
- Background set to transparent
![图片[15]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520100001530-image.png)
- Text color is the main brand color
![图片[16]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520100026186-image.png)
- Fill background color on hover, text becomes white
![图片[17]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520100128664-image.png)
- inheritable
btn-primaryThe visual uniformity of the borders, rounded corners, inside margins, etc.
2. Link button style (Link)
- Border set to transparent
![图片[18]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520100401992-image.png)
- Show only border color on hover, no background change
![图片[19]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520100504440-image.png)
- Background color: change to transparent and border color to dark.
![图片[20]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520100631220-image.png)
- When hovering, the border effect is displayed
![图片[21]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520100931777-image.png)
- Effect when not hovering
![图片[22]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520101010592-image.png)
V. Style Priority and Order Description
exist GenerateBlocks → Global Styles:
- Ability to view specific properties and states (default, hover) for each style class
![图片[23]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520101233259-image.png)
- Similar to CSS, a class added later will override the style of the class before it.
![图片[24]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520101258306-image.png)
- You can adjust the order of the classes by dragging them to control the priority of the styles to take effect.
![图片[25]-GenerateBlocks Pro 全局按钮样式教程:创建可复用按钮设计](https://www.361sale.com/wp-content/uploads/2025/05/20250520101336940-image.png)
VI. Advantages of unified maintenance and management
Once the button classes have been created, these style classes can be used directly anywhere on the site. Modify them once and the buttons are synchronized across the site, helping to improve efficiency and consistency.
Example:
- modifications
btn-primaryor rounded corners, all buttons that reference it will automatically synchronize the adjustment of the - After updating the hover effect, you don't need to repeat the setting
concluding remarks
GenerateBlocks Pro's Global Style system is a useful tool for building modular button designs. Splitting and reusing properties such as the main button, shadow, border, color, etc. saves time and reduces repetitive actions.
If you're using GenerateBlocks to build the WordPress website, it is recommended that global button styling be part of the standard development process to help you quickly build uniformly styled website components.
Welcome to Photon Fluctuations for more WordPress efficient site building tutorials and design practice content.
Recent Updates
Link to this article:https://www.361sale.com/en/55269/The article is copyrighted and must be reproduced with attribution.


















![表情[wozuimei]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![表情[baoquan]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments