Custom CSS not applying correctly is a common issue that can occur due to several factors. Here are the most effective solutions to resolve CSS problems in DigiFusion.
Check CSS Specificity
WordPress themes often have high specificity selectors that override custom CSS. Increase your CSS specificity by being more specific with your selectors.
Instead of:
.button {
background-color: #ff0000;
}
Use:
body .button {
background-color: #ff0000 !important;
}
Verify CSS Syntax
Ensure your CSS syntax is correct. A single syntax error can prevent all subsequent CSS rules from applying.
Common syntax errors include:
- Missing semicolons at the end of declarations
- Missing closing brackets
- Incorrect property names
- Invalid property values
Clear Caching
If you’re using caching plugins or CDN services, clear all caches after adding custom CSS:
- Clear any caching plugin cache
- Clear browser cache (Ctrl+F5 or Cmd+Shift+R)
- Clear CDN cache if applicable
Use Browser Developer Tools
Open your browser’s developer tools (F12) to inspect elements and check if your CSS is being applied:
- Right-click on the element you’re trying to style
- Select “Inspect Element”
- Check the Styles panel to see if your CSS appears
- Look for crossed-out styles indicating they’ve been overridden
Add CSS in the Correct Location
Ensure you’re adding custom CSS in the proper location:
Navigate to Appearance > Customize > Additional CSS and add your custom styles there.
Alternatively, you can add CSS to your child theme’s style.css
file:
/* Your custom CSS here */
.your-custom-class {
property: value;
}
Check for Plugin Conflicts
Deactivate all plugins temporarily to see if the CSS starts working. If it does, reactivate plugins one by one to identify the conflicting plugin.
Use More Specific Selectors
Target elements more precisely by using specific class names or IDs that DigiFusion uses:
.digi-page-wrapper .your-element {
property: value;
}
#content .your-element {
property: value;
}
Verify CSS Loading Order
Custom CSS should load after the theme’s main stylesheet. If you’re enqueueing CSS through functions.php, ensure proper dependency:
wp_enqueue_style(
'custom-style',
'path-to-your-css',
array('digifusion-style'),
'1.0.0'
);
Check Media Queries
If your CSS includes media queries, verify they’re formatted correctly:
@media (max-width: 768px) {
.your-element {
property: value;
}
}
Test with Simple CSS
Start with basic CSS to confirm the system is working:
body {
background-color: red !important;
}
If this simple rule works, gradually add your intended CSS rules to isolate the problematic code.