How can we help you today?

How to Add Gradient Effect to the Button Design Element Using Custom CSS

By default, you can only apply solid colors to the Button Design Element:


default button color


With Custom CSS, you can add a gradient effect to the Button Design Element. Follow the steps below to learn how.


button with css


Quick Walkthrough

  1. Go to the SharePoint page you want to use and Edit the ShortPoint web part.
  2. Copy the CSS of the gradient style you want to apply. You can see the Gradient Style section to see all the styles you can use.
  3. Edit the Button Design Element.
  4. Go to the Custom CSS tab and paste the code.
  5. Customize the linear-gradient values and the border-radius value according to your needs.
  6. Click the green check mark.
  7. Click Save to apply all your changes.

TABLE OF CONTENTS


Prerequisites

  • You must have the latest version of ShortPoint SPFx installed on your SharePoint environment.
  • You must be a ShortPoint Designer with an active license.
  • You must already have the Button Design Element on your SharePoint page and it must have the Primary color of your SharePoint Theme as its background color.


primary color


 Interactive Tutorial

Before starting the interactive tutorial, copy the CSS of the Gradient Style you'd like to use. You can see them in the Gradient Style section.


Step-by-step Tutorial

Follow the steps below for a detailed guide on how to add gradient effect to the Button Design Element:


Step 1: Edit the ShortPoint Web Part

  • Go to the SharePoint page you want to use and click Edit:


Edit

  • Close the Toolbox:

close toolbox


  • Select the ShortPoint tag.
  • Click the Edit Properties icon:

Edit properties icon


Step 2: Copy the Code


Step 3: Edit the Button Design Element

NOTEBefore proceeding, make sure you already have the Button Design Element on your SharePoint page. To learn how to add it, check out How to Customize the Button Design Element. You must also set the background color of the button to Primary to ensure that the text inside can be vividly seen once you add the gradient effect: 

primary color


  • Click the Button tag:

Button


  • Select the cogwheel icon:

cogwheel icon


Step 4: Paste the Code

  • Click the next icon:

next icon


  • Go to the Custom CSS tab.
  • Paste the code.
  • Customize the code according to your preferences:

customize values


Step 5: Save

  • Once satisfied with your edits, click the green check mark.
  • Click the eye icon to see your page in real-time:

eye icon


  • Click Save to apply all your changes:

Save


Well done! You can now add gradient colors to your Buttons.


Gradient Styles 

We've compiled some gradient styles you can use below. Copy the style that best suits your needs:


DESIGN TIPYou can use a color picker to get the HEX of the color you want to use.


Basic Linear Gradient

Basic Linear Gradient

background: linear-gradient(#5A37A5, #0055ff); 
border-radius: 10px !important;

Here are the values you can customize:

  • #5A37A5 - replace with the HEX of the color you want to use;
  • #0055ff - replace with the HEX of the color you want to use;
  • 10 px - replace the border-radius value according to your preferences.

Horizontal Gradient

Horizontal Gradient

background: linear-gradient(to right, #5A37A5, #0055ff); 
border-radius: 10px !important;

Here are the values you can customize:

  • right  - defines the direction of the gradient. You can replace this with left.
  • #5A37A5 - replace with the HEX of the color you want to use;
  • #0055ff - replace with the HEX of the color you want to use;
  • 10 px - defines the border-radius value. Adjust this according to your preferences.

Radial GradientRadial Gradient

background: radial-gradient(circle, #020024 0%, #5A37A5 35%, #0055ff 100%);
border-radius: 10px !important;

Here are the values you can customize:

  • circle  - defines the shape of the gradient. You can replace this with an ellipse;
  • #020024 - replace with the HEX of the color you want to use;
  • 0% - defines the distance of the first color to the center. You can adjust this value according to your preference;
  • #5A37A5 - replace with the HEX of the color you want to use;
  • 35% - defines the distance of the second color to the center. You can adjust this value according to your preference;
  • #0055ff - replace with the HEX of the color you want to use;
  • 100% - defines the distance of the third color to the center. You can adjust this value according to your preference;
  • 10 px - defines the border-radius value. Adjust this according to your preferences.

Conic Gradient

Conic Gradient

background: conic-gradient(#5A37A5, #0055ff);
border-radius: 10px !important;

Here are the values you can customize:

  • #5A37A5 - replace with the HEX of the color you want to use;
  • #0055ff - replace with the HEX of the color you want to use;
  • 10 px - defines the border-radius value. Adjust this according to your preferences.

Related articles:

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 61 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more