Add a Parallelogram Background to a Divi Button Module

Written by Dan Mossop

Looking to add a unique twist to your Divi Buttons? Styling a Divi Button’s background as a parallelogram is a striking way to enhance your page design. Follow the steps below to achieve this effect using custom CSS in Divi.

Before diving into the steps, here’s a preview of what we'll accomplish:

Add a Parallelogram Background to a Divi Button using CSS

Here's how to give a button module a parallelogram background using some CSS code.

1) Navigate to the page where you want to apply the parallelogram effect and open the Divi Builder. Find the specific button you’d like to style.

2) Locate the Button's "Before" Custom CSS Box. To do so:

  • Click on the settings icon for the button.
  • Go to the "Advanced" tab and then the "Custom CSS" section.
  • Under "Module Elements," locate the "Before" option.

3) Insert the CSS Code

Copy and paste the following CSS code under "Before" to create the parallelogram effect:

1display: block;
2opacity: 1;
3content: '';
4position: absolute;
5width: 100%;
6height: 100%;
7background: #4a0891;
8transform: skew(-10deg); /* Set parallelogram angle */
9top: 0;
10right: 0;
11z-index: -1;
12box-shadow: 6px 7px 2px 1px rgba(0, 0, 0, 0.3);

Explanation of the CSS:

  • display: block; Ensures the pseudo-element is visible.
  • content: ''; Displays the pseudo-element.
  • position: absolute; Positions the pseudo-element relative to the button.
  • width: 100%; height: 100%; Covers the entire button.
  • background: #4a0891; Sets the background color; adjust as needed.
  • transform: skew(-10deg); Applies the skew effect to create the parallelogram.
  • z-index: -1; Places the pseudo-element behind the button content.
  • box-shadow: 6px 7px 2px 1px rgba(0, 0, 0, 0.3); Adds a shadow for depth.

Removing Existing Background and Borders

Note that this method of setting the background isn't compatible with the existing Divi Button module's background, border and box shadow methods – these settings will apply to the regular, non-skewed background area. Accordingly, it is advisable to unset these settings to ensure that the parallelogram background can display correctly.

This simple yet effective technique can enhance the overall aesthetics of your Divi website.

Supercharge Your Posts with AI-Generated CTAs

Transform your WordPress site with WP Magic CTAs. Our AI-driven plugin creates customized call-to-actions for each post, helping you increase engagement and conversions effortlessly. Perfect for posts like the one you've just read, this plugin will tailor CTAs specifically to engage your readers.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

0 Comments

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.

We may earn a commission when you visit links on our website.

Latest From Divi Booster

Set Hover Color for Menu Links in the Divi Menu Module

Customizing the hover color of menu links lets you enhance the user experience and maintain visual consistency with your website’s brand. By setting a specific hover color, you can guide visitors' attention and improve navigation feedback. In this guide we show you...

Enable Automatic Looping for YouTube Videos in the Divi Video Module

Enabling automatic looping for YouTube videos in your Divi video module ensures that content plays seamlessly and continuously without interruption. This feature can enhance user engagement, highlight key information, or create dynamic visual effects on your website....

Hide Video Controls in Divi Video Module

Disabling YouTube video controls in the Divi Video Module helps create a seamless, distraction-free viewing experience for your site visitors. This approach is useful when you want full control over how your video content appears and is interacted with on the page, or...

Mute YouTube Videos by Default in the Divi Video Module

In the Divi Video Module, starting your YouTube videos muted by default can create a more user-friendly browsing experience on your webpage. It is particularly beneficial for reducing distractions, enhancing visitor engagement, and providing a seamless content preview...

Autoplay Videos in Divi Video Module

Enabling videos in your Divi video module to start playing automatically can enhance both the site's design and user engagement. To ensure full compatibility with browser requirements, such as Chrome's autoplay policy, it's often necessary to start your videos muted...

Random Divi Posts