Discount Widget CSS Styling Reference
Complete CSS reference for customizing your geo-targeted coupon banners and personalized discount widgets. Create professional-looking campaigns that match your brand while maintaining optimal performance across all devices.
BEM Naming Convention
CoupEdge banners use BEM (Block Element Modifier) naming convention for consistent styling. All classes follow the pattern:
.coupedge-banner__element--modifier. You can optionally set a custom class prefix that will be prepended to all classes.Container Styling
Customize the main banner container, positioning, and responsive behavior for your discount widgets.
Visual Elements
Style buttons, icons, text, and interactive elements to match your brand identity.
Advanced Effects
Add animations, transitions, and advanced styling for premium discount campaigns.
Main Container Classes
| Class Name | Description | Example CSS |
|---|---|---|
| .coupedge-banner | The main banner container element | .coupedge-banner { box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important; border-radius: 8px !important; } |
| .coupedge-banner--simple | Simple horizontal layout modifier | .coupedge-banner--simple { padding: 16px 24px !important; } |
| .coupedge-banner--floating | Floating card layout modifier | .coupedge-banner--floating { max-width: 400px !important; border-radius: 16px !important; } |
| .coupedge-banner--popup | Modal popup layout modifier | .coupedge-banner--popup { max-width: 500px !important; padding: 32px !important; } |
| .coupedge-banner--top | Position at top of page | .coupedge-banner--top { top: 0 !important; } |
| .coupedge-banner--bottom | Position at bottom of page | .coupedge-banner--bottom { bottom: 20px !important; } |
Theme Modifier Classes
| Class Name | Description | Example CSS |
|---|---|---|
| .coupedge-banner--theme-light | Light theme styling | .coupedge-banner--theme-light { background: #ffffff !important; color: #333333 !important; } |
| .coupedge-banner--theme-dark | Dark theme styling | .coupedge-banner--theme-dark { background: #1a1a1a !important; border: 1px solid #333 !important; } |
| .coupedge-banner--theme-colorful | Colorful gradient theme | .coupedge-banner--theme-colorful { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; } |
| .coupedge-banner--theme-gradient | Gradient theme styling | .coupedge-banner--theme-gradient { background: linear-gradient(90deg, #ff8a00, #e52e71) !important; } |
Content & Layout Classes
| Class Name | Description | Example CSS |
|---|---|---|
| .coupedge-banner__content | Main content wrapper | .coupedge-banner__content { padding: 0 20px !important; gap: 16px !important; } |
| .coupedge-banner__message | Message container | .coupedge-banner__message { font-weight: 600 !important; letter-spacing: 0.3px !important; } |
| .coupedge-banner__message-text | Actual message text | .coupedge-banner__message-text { font-family: 'Inter', sans-serif !important; font-size: 16px !important; } |
| .coupedge-banner__actions | Action buttons container | .coupedge-banner__actions { gap: 12px !important; flex-wrap: wrap !important; } |
| .coupedge-banner__header | Popup layout header | .coupedge-banner__header { text-transform: uppercase !important; letter-spacing: 1px !important; } |
| .coupedge-banner__body | Popup layout body | .coupedge-banner__body { text-align: center !important; margin: 16px 0 !important; } |
Message & Text Classes
| Class Name | Description | Example CSS |
|---|---|---|
| .coupedge-banner__icon | Icon wrapper element | .coupedge-banner__icon { background: rgba(255,255,255,0.2) !important; border-radius: 50% !important; padding: 8px !important; } |
| .coupedge-banner__countdown | Countdown timer display | .coupedge-banner__countdown { font-family: 'Courier New', monospace !important; background: rgba(0,0,0,0.2) !important; padding: 6px 12px !important; border-radius: 6px !important; } |
| .coupedge-banner__context | Contextual information text | .coupedge-banner__context { font-style: italic !important; opacity: 0.85 !important; font-size: 0.9em !important; } |
| .coupedge-banner__branding | CoupEdge branding link | .coupedge-banner__branding { display: none !important; /* Hide branding */ } |
Button & Interactive Element Classes
| Class Name | Description | Example CSS |
|---|---|---|
| .coupedge-banner__button | Base button class | .coupedge-banner__button { text-transform: uppercase !important; font-weight: bold !important; transition: transform 0.2s !important; } .coupedge-banner__button:hover { transform: translateY(-2px) !important; } |
| .coupedge-banner__button--primary | Primary action button | .coupedge-banner__button--primary { background: #667eea !important; border-radius: 8px !important; padding: 12px 24px !important; } |
| .coupedge-banner__button--copy | Copy code button | .coupedge-banner__button--copy { border: 1px dashed rgba(255,255,255,0.5) !important; border-radius: 6px !important; } .coupedge-banner__button--copy.copied { background: rgba(76, 175, 80, 0.2) !important; } |
| .coupedge-banner__close | Close button | .coupedge-banner__close { background: rgba(0,0,0,0.1) !important; border-radius: 50% !important; width: 32px !important; height: 32px !important; } .coupedge-banner__close:hover { background: rgba(0,0,0,0.2) !important; transform: rotate(90deg) !important; } |
Layout-Specific Classes
| Class Name | Description | Example CSS |
|---|---|---|
| .coupedge-banner__content--floating | Floating layout content wrapper | .coupedge-banner__content--floating { padding: 20px !important; box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important; } |
| .coupedge-banner__message--floating | Floating layout message | .coupedge-banner__message--floating { font-size: 14px !important; line-height: 1.5 !important; } |
| .coupedge-banner__icon--floating | Floating layout icon | .coupedge-banner__icon--floating { font-size: 1.5em !important; margin-bottom: 8px !important; } |
Advanced CSS Examples
Animated Banner Entry
.coupedge-banner {
animation: slideInFromTop 0.5s ease-out !important;
}
@keyframes slideInFromTop {
from {
transform: translateY(-100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}Custom Floating Banner Style
.coupedge-banner--floating {
border-radius: 20px !important;
box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4) !important;
border: 2px solid rgba(255, 255, 255, 0.1) !important;
}
.coupedge-banner--floating:hover {
transform: translateY(-5px) !important;
transition: transform 0.3s ease !important;
}Gradient Button Effect
.coupedge-banner__button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
position: relative !important;
overflow: hidden !important;
}
.coupedge-banner__button--primary::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
transition: left 0.5s;
}
.coupedge-banner__button--primary:hover::before {
left: 100%;
}Pulsing Copy Button
.coupedge-banner__button--copy {
animation: pulse 2s infinite !important;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
}
70% {
box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
}
}Gradient Text Effect
.coupedge-banner__message-text {
background: linear-gradient(90deg, #ff8a00, #e52e71) !important;
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent !important;
background-clip: text !important;
font-weight: bold !important;
}Custom Close Button
.coupedge-banner__close {
background: transparent !important;
border: 2px solid rgba(255,255,255,0.5) !important;
border-radius: 50% !important;
width: 28px !important;
height: 28px !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
transition: all 0.3s ease !important;
}
.coupedge-banner__close:hover {
transform: rotate(90deg) !important;
border-color: white !important;
background: rgba(255,255,255,0.1) !important;
}Dark Theme Customization
.coupedge-banner--theme-dark {
background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%) !important;
border: 1px solid #404040 !important;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}
.coupedge-banner--theme-dark .coupedge-banner__button {
background: rgba(255, 255, 255, 0.1) !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
}
.coupedge-banner--theme-dark .coupedge-banner__button:hover {
background: rgba(255, 255, 255, 0.2) !important;
}Responsive Design
The CoupEdge banner system includes built-in responsive behavior. You can further customize it for different screen sizes:
Mobile Customization (up to 768px)
@media (max-width: 768px) {
.coupedge-banner {
padding: 12px 16px !important;
font-size: 14px !important;
}
.coupedge-banner--floating {
right: 8px !important;
left: 8px !important;
bottom: 8px !important;
max-width: none !important;
}
.coupedge-banner__button {
padding: 10px 16px !important;
font-size: 13px !important;
}
.coupedge-banner__actions {
flex-direction: column !important;
width: 100% !important;
}
}Tablet Customization (768px - 1024px)
@media (min-width: 768px) and (max-width: 1024px) {
.coupedge-banner {
padding: 14px 20px !important;
}
.coupedge-banner--floating {
max-width: 350px !important;
}
}Desktop Customization (1024px+)
@media (min-width: 1024px) {
.coupedge-banner__button {
padding: 12px 28px !important;
}
.coupedge-banner--floating {
max-width: 450px !important;
}
.coupedge-banner__message-text {
font-size: 18px !important;
}
}CSS Best Practices
Performance Tips
- Use CSS properties that don't trigger layout recalculations (transform, opacity, color, background)
- Avoid excessive animations that might impact page performance
- Use
!importantsparingly - only when necessary to override inline styles - Keep your custom CSS concise and focused on specific changes
- Test performance on mobile devices for smooth animations
Compatibility Tips
- Test your custom CSS across different browsers (Chrome, Firefox, Safari, Edge)
- Use vendor prefixes for experimental CSS properties (-webkit-, -moz-, etc.)
- Avoid using CSS that might conflict with your website's existing styles
- Consider using a custom class prefix to prevent conflicts
- Verify responsive behavior on various screen sizes and devices
Selector Best Practices
- Be specific with selectors to target only banner elements
- Use BEM naming convention for clarity:
.coupedge-banner__element--modifier - Avoid overly broad selectors like
buttonordiv - Target specific layout or theme combinations when needed
CSS Variables Approach
- Define reusable CSS custom properties for consistent styling
- Use variables for colors, spacing, and other repeated values
- Makes it easier to update multiple styles at once
:root {
--banner-primary: #667eea;
--banner-radius: 12px;
}
.coupedge-banner {
background: var(--banner-primary) !important;
border-radius: var(--banner-radius) !important;
}Custom Prefix Support
You can set a custom class prefix to avoid conflicts with existing CSS. Use the
classPrefix option when initializing the banner. All classes will be prefixed with your custom string.CoupEdge.init('your-product-id', {
classPrefix: 'my-site'
});
// Generates: .my-site-coupedge-bannerImportant Note
Custom CSS is applied after all other banner styles. This means your custom CSS will override the default styles, giving you complete control over the appearance of your banner. Use
!important when needed to override inline styles generated by the banner system.