Creating Hovering Social Icon Buttons with GeneratePress and GenerateBlocks Tutorial

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 的完整教程

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 的完整教程
  • Named Sticky Social Icons
  • Element type selection Hook
图片[3]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程
  • The hook position is set to after_header
  • Display Rule Selection Entire Site
图片[4]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程

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 的完整教程
  • Remove all default inner margins
  • Set the z-index to 99 to make it appear at the top of the page
图片[6]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程
  • 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 的完整教程

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 的完整教程
  • 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 的完整教程
  • Copy the button and replace it with another icon (e.g. Twitter, LinkedIn)
  • Last button removes the bottom border
图片[10]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程
  • Set button containers to be vertically stacked and fill the horizontal space
图片[11]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程

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 的完整教程

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 的完整教程
  • To enable Box Shadow, adjust the following parameters:
    • Horizontal and vertical offsets
    • ambiguity
    • color depth
图片[14]-创建桌面端悬浮社交图标按钮:使用 GeneratePress 和 GenerateBlocks 的完整教程
  • 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 的完整教程

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


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
客服微信
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: [email protected]
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
本文作者:托尼屎大颗
THE END
If you like it, support it.
kudos1123 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments