In modern website design, eye-catching social icons boost interaction rates and brand exposure. This article introduces the use of GeneratePress With the GenerateBlocks plugin (free version) create a clean, beautiful, social icon bar that hovers on the left side of the desktop and hides on mobile.
![图片[1]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516095113458-image.png)
I. Preparatory work
This tutorial is for websites using the GeneratePress theme and the tools required are listed below:
- GenerateBlocks plugin (free version)
- GeneratePress Theme (Block Element recommended for use with GP Premium)
Second, the new element (Block Element)
- log in WordPress In the background, go to "Appearance" → "Elements" → Add New Element.
![图片[2]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516095553466-image.png)
- Named Sticky Social Icons
- Element type selection Hook
![图片[3]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516095629357-image.png)
- The hook position is set to
after_header - Display Rule Selection Entire Site
![图片[4]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516095721910-image.png)
Third, add the container and set the style
- Add a Container block
- Set the width to "Contained Width", the width value is 48px.
![图片[5]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516095844487-image.png)
- Remove all default inner margins
- Set the z-index to 99 to make it appear at the top of the page
![图片[6]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516095929128-image.png)
- Add two CSS Class:
sticky-social-icons(for subsequent CSS positioning)hide-on-mobile(system built-in class, hidden on mobile)
If you have GenerateBlocks Pro you can click the Enable Hide on moblie button.
![图片[7]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516100250604-image.png)
IV. Add social icon buttons
- Add a Buttons block to the container
- Insert the button and select the social icon (e.g. Facebook)
- Remove button text and keep only the icon
![图片[8]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516100541786-image.png)
- Set the inner margins of the four sides to 15px
- Add a 1px bottom border to be used as a separator between icons
![图片[9]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516100646909-image.png)
- Copy the button and replace it with another icon (e.g. Twitter, LinkedIn)
- Last button removes the bottom border
![图片[10]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516100830140-image.png)
- Set button containers to be vertically stacked and fill the horizontal space
![图片[11]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516100910835-image.png)
V. Add custom CSS to achieve positioning
Go to "Appearance → Customize → Add-ons CSS", paste the following style:
.sticky-social-icons {
position: fixed;
left: 20px;
top: 200px;
}
![图片[12]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516101020102-image.png)
The numeric section can be fine-tuned to the actual page position.
VI. Add shadow effect (optional, requires Pro version)
When using GenerateBlocks Pro, you can add button shadows to enhance three-dimensionality:
- Select the container block and enter the "Effects" settings.
![图片[13]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516101252995-image.png)
- To enable Box Shadow, adjust the following parameters:
- Horizontal and vertical offsets
- ambiguity
- color depth
![图片[14]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516101209201-image.png)
- Click Update and refresh the page to preview the effect
VII. Final effect
Implemented a social button bar fixed on the left side of the page, still displayed when the page scrolls, not displayed on mobile, adapting to multiple devices and visual needs.
![图片[15]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程](https://www.361sale.com/wp-content/uploads/2025/05/20250516101330314-image.png)
concluding remarks
utilization GeneratePress With GenerateBlocks, it's possible to create professional-grade hover social buttons even without using complex plugins. To add advanced styles such as hover animations, transparency gradients, and more, you can also extend the CSS Code Implementation.
Recent Updates
Link to this article:https://www.361sale.com/en/54715/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