Styling
Customize the visual appearance of your theme with CSS.
CSS Structure
Organize CSS files by purpose:
public/assets/theme/my-theme/css/
├── main.css # Main stylesheet (loaded everywhere)
├── admin.css # Admin panel specific
├── dashboard.css # Dashboard specific
├── auth.css # Login/register pages
├── components/
│ ├── buttons.css
│ ├── cards.css
│ ├── forms.css
│ └── tables.css
└── utilities.css # Helper classesIncluding Stylesheets
In your template:
{% block head_stylesheets %}
{{ parent() }} {# Include default styles #}
{# Your theme styles #}
<link rel="stylesheet" href="{{ asset('assets/theme/my-theme/css/main.css') }}">
<link rel="stylesheet" href="{{ asset('assets/theme/my-theme/css/components/buttons.css') }}">
{% endblock %}Bootstrap Customization
PteroCA uses Bootstrap. Customize Bootstrap variables:
Dark Mode
Implement dark mode support:
Toggle dark mode with JavaScript:
Custom Components
Custom buttons:
Custom cards:
Responsive Design
Ensure mobile compatibility:
Bootstrap Breakpoints
PteroCA uses Bootstrap's default breakpoints:
X-Small
None
<576px
Small
sm
≥576px
Medium
md
≥768px
Large
lg
≥992px
Extra large
xl
≥1200px
Extra extra large
xxl
≥1400px
Common CSS Patterns
Glassmorphism effect:
Gradient backgrounds:
Smooth animations:
CSS Best Practices
Scope your styles - avoid affecting core elements
Use CSS variables - easier theme customization
Prefix custom classes - avoid conflicts (e.g.,
.mytheme-card)Minimize
!important- use specificity insteadOptimize for performance - minify for production
Test across browsers - ensure compatibility
Make responsive - test on mobile devices
Performance Tips
Minimize file size:
Use efficient selectors:
Avoid expensive properties:
Debugging CSS
Browser DevTools:
Right-click element → Inspect
Check Computed tab for applied styles
Use Styles tab to modify styles in real-time
Check for overridden styles (crossed out)
Common issues:
Styles not applying → Check selector specificity
Layout broken → Inspect box model in DevTools
Responsive issues → Use responsive design mode
Performance → Use Lighthouse audit
Related Guides
Theme Structure - File organization
Overriding Templates - Customize templates
JavaScript - Add interactivity
Testing - Quality assurance
External Resources
Can I Use - Browser compatibility
Last updated