How to Add Custom CSS in Elementor

How to Add Custom CSS in Elementor

Adding custom CSS in Elementor can help you achieve a unique look and feel, taking your website design to the next level. Here’s a step-by-step guide on how to add CSS within Elementor and some best practices to keep in mind.

1. Why Use Custom CSS in Elementor?

While Elementor offers a wide range of design settings, some customizations require CSS for greater control over spacing, animations, or specific style tweaks that Elementor's settings may not provide. Adding CSS enables you to customize any element's appearance, making it easy to implement branded or original styles.

2. Adding Custom CSS to an Elementor Element

Elementor Pro allows you to add CSS directly to widgets and sections, making it convenient to style individual parts of your page. To add CSS to a specific element:

  • Open your Elementor editor and select the widget or section you wish to style.
  • In the left panel, go to the Advanced tab and scroll to the Custom CSS section.
  • Enter your CSS code directly here.

Example:

selector {
    background-color: #f0f0f0;
    border-radius: 10px;
    padding: 20px;
}

Using the selector keyword allows the CSS to apply directly to the specific element you’re editing without needing a unique class name.

3. Adding Custom CSS Globally

For styles that should apply site-wide, you may prefer adding CSS globally. Elementor doesn’t directly support site-wide CSS, but there are alternative methods:

  • Theme Customizer: Go to Appearance > Customize > Additional CSS in the WordPress dashboard. Paste your global CSS here for changes across all pages.
  • CSS in Theme Files: If you’re comfortable with editing files, add CSS to the theme’s style.css file. Be cautious, as this will override your theme’s styles and requires a child theme to prevent losing changes during updates.

4. Using the CSS Class Option

For added flexibility, you can apply custom CSS through classes. Assign a CSS class to an Elementor widget, then style that class in your global CSS settings:

  • Select the widget in Elementor and go to the Advanced tab.
  • Under CSS Classes, enter a name (e.g., my-custom-button).
  • Add your CSS rules in the Additional CSS section or a theme file:

5. Using Custom CSS for Hover Effects and Animations

CSS can also enhance Elementor’s built-in animations or hover effects. For example, to create a “scale-up” effect on hover:

  • Assign a CSS class like scale-hover to your element.
  • In your CSS, add:
.scale-hover {
    transition: transform 0.3s ease;
}
.scale-hover:hover {
    transform: scale(1.1);
}

6. Testing and Debugging CSS in Elementor

Use your browser’s Inspect Element tool to view CSS changes in real time. This tool helps identify any issues or unwanted styles by highlighting the CSS rules in place for each element. It’s particularly useful if your CSS is overridden by theme styles or other plugins.

Key Tips for Adding Custom CSS in Elementor

  • Organize CSS by creating descriptive class names to avoid confusion and make maintenance easier.
  • Check Mobile Responsiveness: Use media queries within your CSS or Elementor’s responsive tools to ensure your customizations look good across all devices.
  • Backup Your CSS in a separate file or document, especially if you’re adding it to theme files, to prevent loss during updates.

By following these steps, you can easily use custom CSS to tailor your Elementor designs and achieve a fully customized WordPress website.