Paint Outside the Lines: Advanced Background & Border Techniques
🎨 Transform Your Counter’s Visual Foundation
While WhoKnew Views provides intuitive background and border controls in the Styling settings, Custom CSS unlocks an entirely new dimension of visual possibilities. From multi-color gradients and radial bursts to animated borders and layered shadows, this guide reveals how to craft backgrounds and borders that captivate your visitors.
💡 Quick Context
The built-in settings offer horizontal gradients (left-to-right), solid colors, and standard border styles. Custom CSS gives you diagonal gradients, radial bursts, conic rainbows, repeating patterns, border images, multiple shadows, and advanced effects that aren’t possible through the standard interface.
🎯 Understanding the Target Selectors
All background and border styling targets the wrapper element that contains your counter’s icon and text:
.product-views-counter .view-counter-wrapper {
/* Your background and border styles here */
}
For per-product customization, add the product ID to your selector:
.postid-1234 .product-views-counter .view-counter-wrapper {
/* Product-specific styling */
}
🌈 Advanced Background Gradients
The built-in gradient system creates horizontal gradients (left-to-right). Custom CSS provides unlimited gradient directions, types, and complexity.
Linear Gradients: All Directions
While the plugin offers to right, CSS supports 8 directional keywords and 360 degrees of rotation:
| Direction | CSS Syntax | Visual Flow |
|---|---|---|
| Top to Bottom | to bottom or 180deg | ↓ Vertical descent |
| Bottom to Top | to top or 0deg | ↑ Vertical ascent |
| Left to Right | to right or 90deg | → Built-in default |
| Right to Left | to left or 270deg | ← Reverse horizontal |
| Diagonal (Top-Left) | to top left or 315deg | ↖️ Northwest sweep |
| Diagonal (Top-Right) | to top right or 45deg | ↗️ Northeast sweep |
| Diagonal (Bottom-Left) | to bottom left or 225deg | ↙️ Southwest sweep |
| Diagonal (Bottom-Right) | to bottom right or 135deg | ↘️ Southeast sweep (popular!) |
📐 Example: Diagonal Gradient (135°)
.product-views-counter .view-counter-wrapper {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}
Result: A smooth purple-to-pink gradient flowing from top-left to bottom-right—one of the most visually pleasing gradient angles for rectangular elements.
🎨 Example: Vertical Gradient (Top-Down)
.product-views-counter .view-counter-wrapper {
background: linear-gradient(to bottom, #3b82f6 0%, #1e40af 100%) !important;
}
Result: Bright blue at the top fading to deep navy at the bottom—creates a sense of depth and foundation.
Multi-Stop Gradients: Beyond Two Colors
The built-in gradient uses two colors (start + end). Custom CSS allows unlimited color stops at precise positions:
.product-views-counter .view-counter-wrapper {
background: linear-gradient(
90deg,
#ff0080 0%,
#ff8c00 25%,
#40e0d0 50%,
#ff8c00 75%,
#ff0080 100%
) !important;
}
Result: A vibrant rainbow that flows from hot pink → orange → turquoise → orange → hot pink. Perfect for bold, eye-catching counters on promotional products.
🌅 Example: Sunset Gradient (Four Stops)
.product-views-counter .view-counter-wrapper {
background: linear-gradient(
to bottom,
#ffd89b 0%,
#ff6b6b 40%,
#4e54c8 70%,
#1a1a2e 100%
) !important;
}
Result: A breathtaking sunset effect—golden yellow transitions to coral, then deep purple-blue, finally settling into dark night. Creates dramatic emotional impact.
Radial Gradients: Circular & Elliptical Bursts
Radial gradients emanate from a central point outward, creating spotlight effects, glowing orbs, and vignettes. Not available in the built-in settings.
🔵 Example: Centered Radial Burst
.product-views-counter .view-counter-wrapper {
background: radial-gradient(circle at center, #fbbf24 0%, #f59e0b 50%, #d97706 100%) !important;
}
Result: A bright golden glow at the center that deepens to rich amber at the edges—mimics a spotlight or coin effect. Excellent for premium products.
💎 Example: Offset Radial Gradient
.product-views-counter .view-counter-wrapper {
background: radial-gradient(
ellipse at top right,
#10b981 0%,
#059669 50%,
#047857 100%
) !important;
}
Result: An elliptical (stretched) gradient originating from the top-right corner, creating an asymmetric emerald-to-forest-green sweep. Adds dynamic energy to your counter.
⚡ Pro Tip: Radial Gradient Positions
You can position radial gradients at top left, top right, bottom left, bottom right, center, or use precise coordinates like at 30% 70% for pixel-perfect placement. Combine with circle or ellipse shapes for different effects.
Conic Gradients: Circular Rainbows
Conic gradients rotate around a central point like a color wheel, creating rainbow spinners, pie chart effects, and psychedelic patterns.
🌀 Example: Rainbow Spinner
.product-views-counter .view-counter-wrapper {
background: conic-gradient(
from 0deg,
#ff0080,
#ff8c00,
#40e0d0,
#ff0080
) !important;
border-radius: 50% !important; /* Makes it circular */
}
Result: A spinning rainbow that cycles through hot pink, orange, and turquoise—perfect for limited-time offers or flash sales. The final color matches the first to create a seamless loop.
🎯 Example: Half-Circle Conic Gradient
.product-views-counter .view-counter-wrapper {
background: conic-gradient(
from 90deg at 50% 50%,
#3b82f6 0deg,
#8b5cf6 180deg,
#1e293b 180deg,
#1e293b 360deg
) !important;
}
Result: Half the counter displays a blue-to-purple gradient, while the other half remains dark—creates a split-screen or yin-yang effect.
Repeating Gradients: Stripes & Patterns
Repeating gradients create striped patterns, checkered backgrounds, and geometric designs by cycling through color stops.
🦓 Example: Diagonal Stripes
.product-views-counter .view-counter-wrapper {
background: repeating-linear-gradient(
45deg,
#3b82f6,
#3b82f6 10px,
#2563eb 10px,
#2563eb 20px
) !important;
}
Result: Alternating diagonal stripes of bright blue and navy blue, each 10px wide. Creates a candy-cane or barbershop pole effect. Great for attention-grabbing counters.
✨ Example: Subtle Texture Overlay
.product-views-counter .view-counter-wrapper {
background: #3b82f6; /* Solid base color */
background-image: repeating-linear-gradient(
45deg,
transparent,
transparent 10px,
rgba(255,255,255,.05) 10px,
rgba(255,255,255,.05) 20px
) !important;
}
Result: A solid blue background with barely-visible diagonal stripes layered on top—adds sophisticated texture without overwhelming the design. Notice we use background-image to layer the pattern over the solid color.
🎨 Solid & Transparent Backgrounds
While the built-in settings handle solid colors well, Custom CSS provides advanced control over opacity, layering, and color formats.
RGBA Colors: Opacity Control
Unlike hex colors (#3b82f6), RGBA allows you to set transparency via the alpha channel:
.product-views-counter .view-counter-wrapper {
background: rgba(59, 130, 246, 0.8) !important; /* 80% opaque blue */
}
Result: A semi-transparent blue background that allows product images or page backgrounds to subtly show through. The fourth value (0.8) controls opacity: 0 = fully transparent, 1 = fully opaque.
Example: Frosted Glass Effect
.product-views-counter .view-counter-wrapper {
background: rgba(255, 255, 255, 0.15) !important;
backdrop-filter: blur(10px) !important;
border: 1px solid rgba(255, 255, 255, 0.3) !important;
}
Result: A glassmorphism effect where the background blurs what’s behind it, creating a modern, iOS-style frosted glass appearance.
📱 Browser Support Note
backdrop-filter is supported in all modern browsers but may not work in older Safari versions. Consider providing a fallback solid background for maximum compatibility.
🖼️ Border Mastery
The plugin offers 23+ border styles, including solid, dashed, dotted, double, groove, ridge, inset, outset, and neon glows. Custom CSS extends this with gradient borders, image borders, individual side styling, and more.
Gradient Borders
Standard CSS border doesn’t support gradients directly. You need border-image:
.product-views-counter .view-counter-wrapper {
border: 3px solid !important;
border-image: linear-gradient(45deg, #ffd700, #ffed4e, #c5a028, #ffd700) 1 !important;
}
Result: A golden gradient flows around the entire border—mimics a liquid gold frame. Note: border-image overrides border-radius, so rounded corners won’t work with this technique.
🎨 Workaround: Gradient Borders with Rounded Corners
To combine gradient borders with rounded corners, use a pseudo-element technique:
.product-views-counter .view-counter-wrapper {
position: relative !important;
background: #1e293b !important; /* Inner background */
border-radius: 16px !important;
padding: 16px 32px !important;
}
.product-views-counter .view-counter-wrapper::before {
content: '' !important;
position: absolute !important;
inset: -3px !important; /* Border thickness */
background: linear-gradient(135deg, #667eea, #764ba2) !important;
border-radius: 16px !important;
z-index: -1 !important;
}
Result: A purple gradient “border” with rounded corners. The ::before pseudo-element creates a background layer slightly larger than the wrapper (inset: -3px), and the wrapper’s background color covers the center, leaving only the edges visible.
Individual Border Sides
Style each border side independently:
.product-views-counter .view-counter-wrapper {
border-top: 2px solid #3b82f6 !important;
border-right: 4px dashed #8b5cf6 !important;
border-bottom: 2px solid #3b82f6 !important;
border-left: 4px dashed #8b5cf6 !important;
}
Result: Top and bottom have thin solid blue lines; left and right have thicker dashed purple lines. Creates an asymmetric frame effect.
Border Radius: Per-Corner Control
The plugin’s “Rounded Corners (px)” setting applies uniform rounding. Custom CSS allows individual corner radii:
.product-views-counter .view-counter-wrapper {
border-radius: 20px 0 20px 0 !important; /* top-left, top-right, bottom-right, bottom-left */
}
Result: Top-left and bottom-right corners are rounded (20px), while top-right and bottom-left corners are sharp (0px)—creates a wave or scalloped effect.
💎 Example: Organic Shape
.product-views-counter .view-counter-wrapper {
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40% !important;
}
Result: An organic, blob-like shape—each corner has a unique elliptical radius. The syntax is horizontal-radii / vertical-radii. Creates a playful, hand-drawn aesthetic.
☀️ Box Shadow: Depth & Drama
The plugin offers preset box shadows (Small, Medium, Large, Extra Large). Custom CSS provides unlimited shadows, colors, spreads, and layering.
Box Shadow Syntax
box-shadow: [horizontal] [vertical] [blur] [spread] [color] [inset];
| Value | Description | Example |
|---|---|---|
| Horizontal Offset | Distance right (+) or left (-) | 4px (right) |
| Vertical Offset | Distance down (+) or up (-) | 6px (down) |
| Blur Radius | Softness of shadow edge | 12px (soft) |
| Spread Radius | Shadow size (larger or smaller) | 2px (grows) |
| Color | Shadow color (supports RGBA) | rgba(0,0,0,0.3) |
| Inset | Inner shadow (optional keyword) | inset |
Example: Dramatic Colored Shadow
.product-views-counter .view-counter-wrapper {
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6) !important;
}
Result: A deep purple shadow (matching a purple gradient background) with 0px horizontal offset (centered), 8px vertical offset (below), 32px blur (very soft), and 60% opacity. Creates a floating or elevated appearance.
Multiple Box Shadows
Layer multiple shadows by separating them with commas:
.product-views-counter .view-counter-wrapper {
box-shadow:
0 0 20px rgba(255, 215, 0, 0.5),
0 8px 16px rgba(0, 0, 0, 0.3),
inset 0 0 20px rgba(255, 215, 0, 0.1) !important;
}
Result: Three layered shadows:
- Golden glow (outer, no offset) spreading 20px around the counter
- Depth shadow (outer, below) for realistic elevation
- Inner glow (inset) creating a subtle internal highlight
Mimics a premium gold-embossed button effect.
Inset Shadows: Carved & Recessed Effects
.product-views-counter .view-counter-wrapper {
background: #e5e7eb !important;
box-shadow: inset 2px 2px 5px rgba(0,0,0,0.2) !important;
}
Result: A carved-in or debossed appearance—the shadow appears inside the counter, creating the illusion it’s pressed into the page.
⚡ Performance Tip
Avoid excessive blur radii (>30px) or spread radii on multiple shadows, as they can impact render performance on lower-end devices. For animated shadows, use transform and opacity instead of animating box-shadow directly.
🎭 Combining Backgrounds & Borders
Layer multiple backgrounds, combine gradient borders with shadows, and create complex visual effects.
Example: Layered Background Images
.product-views-counter .view-counter-wrapper {
background:
linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(139, 92, 246, 0.9)),
repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px) !important;
}
Result: A semi-transparent blue-purple gradient layered over diagonal stripes—creates textured depth. The first background (gradient) sits on top, the second (stripes) underneath.
Example: Premium Gold Counter
.product-views-counter .view-counter-wrapper {
background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%) !important;
border: 2px solid #c5a028 !important;
border-radius: 12px !important;
box-shadow:
0 0 20px rgba(251, 191, 36, 0.4),
0 8px 16px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}
.product-views-counter .view-counter-text,
.product-views-counter .view-counter-icon {
color: #78350f !important; /* Dark brown text for contrast */
text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5) !important;
}
Result: A radiant golden counter with:
- Diagonal gradient (light gold → amber → dark gold)
- Bronze border
- Golden outer glow
- Depth shadow
- Subtle inner highlight (top edge)
- Dark brown text with light text shadow for maximum legibility
Perfect for VIP products, best-sellers, or premium tiers.
📱 Mobile-Specific Backgrounds & Borders
Override backgrounds and borders for smaller screens:
/* Desktop: Dramatic gradient with large shadow */
.product-views-counter .view-counter-wrapper {
background: linear-gradient(135deg, #667eea, #764ba2) !important;
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6) !important;
}
/* Mobile: Simplified solid color with small shadow */
@media (max-width: 768px) {
.product-views-counter .view-counter-wrapper {
background: #667eea !important; /* Solid instead of gradient */
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}
}
Result: Desktop users see a rich gradient with a large shadow; mobile users see a simplified solid background with a lighter shadow—improves performance and legibility on small screens.
🎯 Per-Product Background Targeting
Apply custom backgrounds to specific products:
/* Best-seller (Product ID 1234): Golden gradient */
.postid-1234 .product-views-counter .view-counter-wrapper {
background: radial-gradient(ellipse at center, #fbbf24 0%, #d97706 100%) !important;
}
/* New arrival (Product ID 5678): Fresh green gradient */
.postid-5678 .product-views-counter .view-counter-wrapper {
background: linear-gradient(135deg, #10b981 0%, #047857 100%) !important;
}
/* Sale item (Product ID 9012): Red alert gradient */
.postid-9012 .product-views-counter .view-counter-wrapper {
background: linear-gradient(90deg, #ef4444 0%, #b91c1c 100%) !important;
box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) !important;
}
Result: Each product’s counter automatically displays a category-appropriate background—gold for best-sellers, green for new arrivals, red for sales. Creates instant visual categorization for shoppers.
🚀 Real-World Examples
Example 1: Neon Cyberpunk Counter
.product-views-counter .view-counter-wrapper {
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
border: 2px solid #06b6d4 !important;
border-radius: 8px !important;
box-shadow:
0 0 20px rgba(6, 182, 212, 0.6),
inset 0 0 20px rgba(6, 182, 212, 0.1) !important;
}
.product-views-counter .view-counter-text,
.product-views-counter .view-counter-icon {
color: #06b6d4 !important;
text-shadow: 0 0 10px rgba(6, 182, 212, 0.8) !important;
}
Use Case: Tech products, gaming accessories, futuristic brands. Creates a neon-lit aesthetic with cyan glow.
Example 2: Minimalist Scandinavian Counter
.product-views-counter .view-counter-wrapper {
background: #ffffff !important;
border: 1px solid #e5e7eb !important;
border-radius: 4px !important;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}
.product-views-counter .view-counter-text,
.product-views-counter .view-counter-icon {
color: #1f2937 !important;
}
Use Case: Clean, minimal brands. White background, thin gray border, subtle shadow, dark text. Non-intrusive elegance.
Example 3: Vintage Newspaper Counter
.product-views-counter .view-counter-wrapper {
background: #f5f5dc !important; /* Beige/cream */
border-top: 3px double #3d3d3d !important;
border-bottom: 3px double #3d3d3d !important;
border-left: none !important;
border-right: none !important;
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05) !important;
}
.product-views-counter .view-counter-text,
.product-views-counter .view-counter-icon {
color: #3d3d3d !important;
font-family: 'Georgia', serif !important;
}
Use Case: Vintage stores, classic brands, heritage products. Mimics an old newspaper headline with double borders on top/bottom only.
⚠️ Troubleshooting
| Issue | Solution |
|---|---|
| Gradient border removes rounded corners | Use the pseudo-element technique shown above—border-image doesn’t support border-radius. |
| Background doesn’t change | Ensure you’re using !important and targeting .product-views-counter .view-counter-wrapper specifically. |
| Multiple backgrounds not layering | Separate backgrounds with commas. First background in the list appears on top, last appears on bottom. |
| Shadow too harsh or barely visible | Adjust the alpha value in RGBA color (e.g., rgba(0,0,0,0.1) for subtle, 0.5 for dramatic). |
| Conic gradient looks pixelated | Ensure the container has border-radius: 50% for circular counters, or increase gradient smoothness by adding more color stops. |
| Backdrop filter not working | Check browser compatibility—older Safari versions don’t support it. Provide a fallback solid background. |
📚 Quick Reference: Essential Properties
| Property | What It Does | Quick Example |
|---|---|---|
background | Sets solid color, gradient, or image | #3b82f6 |
linear-gradient() | Creates directional gradient | linear-gradient(135deg, #667eea, #764ba2) |
radial-gradient() | Creates circular/elliptical gradient | radial-gradient(circle, #fbbf24, #d97706) |
conic-gradient() | Creates spinning rainbow gradient | conic-gradient(from 0deg, #ff0080, #40e0d0) |
repeating-linear-gradient() | Creates repeating stripe patterns | repeating-linear-gradient(45deg, #3b82f6, #3b82f6 10px, #2563eb 10px, #2563eb 20px) |
border | Sets border width, style, color | 2px solid #3b82f6 |
border-radius | Rounds corners | 12px or 20px 0 20px 0 |
box-shadow | Adds drop shadow or glow | 0 8px 16px rgba(0,0,0,0.3) |
backdrop-filter | Blurs/effects behind element | blur(10px) |
rgba() | Color with transparency | rgba(59, 130, 246, 0.8) |