When new content is available, a red badge appears over the notification center and the menu items to alert users. In this tutorial, you will learn how to replace the red badge for the notification center and menu items using custom CSS.
The tutorial walks you through changing the badge to a festive Santa hat or a snow-themed badge to match the season. This includes creating custom badges or selecting the appropriate CSS for Classic UX or New UX depending on which interface you are using.
When using Classic UX on mobile devices, the custom badge is applied only to the notification center, not to menu items.
Santa hat badge
Snow badge
By the end of this tutorial, you’ll understand which CSS selectors control the badge and how to replace it with a custom badge of your choice to create a personalized, seasonal look.
Using custom CSS can result in undesired formatting or styling. Apply custom CSS only if you’re familiar with it, and always preview your app’s appearance after making changes.
Prerequisite
- You are an administrator in the Staffbase Studio.
Customize the notification badge
Customize the notification badge to a Santa hat
- In the Studio, navigate to the Settings > App and Intranet.
The App and Intranet Branding page opens. - Under Custom CSS, select Classic UX.
- In the editor, copy and paste the following CSS lines:
If there are other code snippets in the editor, paste this CSS after the existing code and do not modify the existing code.
/* SANTA HAT ============================= */.desktop span.unread-count:before,.desktop span.notifications__unseen-count:before,.mobile .mobile-menu-header.bg-header-appintranet span.unread-count:before,.mobile .mobile-menu-header.bg-header-appintranet span.notifications__unseen-count:before { content: ""; width: 37px; height: 31px; background: url(https://cc-scripts.staffbase.com/graphics-asset/santa_hat.png) no-repeat top center; position: absolute; top: -10px; left: -7px; z-index: 5; display: block; background-size: 50%; opacity: 1;}/* SANTA HAT ===============================*/- Click Preview to test your CSS customizations in both App and Intranet.
- Click Save.
You have customized the notification badge as a Santa hat.
Customize the notification badge to a snow-themed badge
- In the Studio, navigate to the Settings > App and Intranet.
The App and Intranet Branding page opens. - Under Custom CSS, select Classic UX.
- In the editor, copy and paste the following CSS lines:
If there are other code snippets in the editor, paste this CSS after the existing code and do not modify the existing code.
/* SNOW CAP ============================= */.desktop span.unread-count:before,.desktop span.notifications__unseen-count:before,.mobile .mobile-menu-header.bg-header-appintranet span.unread-count:before,.mobile .mobile-menu-header.bg-header-appintranet span.notifications__unseen-count:before { content: ""; width: 28px; height: 13px; background: url(https://cc-scripts.staffbase.com/graphics-asset/snow_cap.png) no-repeat top center; position: absolute; top: -6px; left: -4.5px; z-index: 5; display: block; background-size: 73%; opacity: 1;}/* SNOW CAP ============================= */- Click Preview to test your CSS customizations in both App and Intranet.
- Click Save.
You have customized the notification badge as a snow badge.
For New UX, target only selectors based on data-c13y-* attributes.
Customize the notification badge to a Santa hat
- In the Studio, navigate to the Settings > App and Intranet.
The App and Intranet Branding page opens. - Under Custom CSS, select New UX.
- In the editor, copy and paste the following CSS lines:
If there are other code snippets in the editor, paste this CSS after the existing code and do not modify the existing code.
/* ===================================================================== CHRISTMAS NOTIFICATION BADGE - Santa Hat for New UX ===================================================================== */
/* Move the bell counter down/left so the hat has space inside (floating menu) =========== */[data-c13y-region="header"] [data-c13y-purpose="notifications"] [data-c13y-component="badge"] { translate: -15px 3px;}
/* Same for the full-width menu ========================= */[data-c13y-region="header"][data-navigation-variant="full-width"] [data-c13y-purpose="notifications"] [data-c13y-component="badge"] { translate: -15px 4px !important;}
/* Mobile sidebar menu bubbles ================================ */[data-c13y-component="mobile-menu-item"] span[aria-label] { position: relative;}
[data-c13y-component="badge"]::before,[data-c13y-component="mobile-menu-item"] span[aria-label]::before { content: ""; position: absolute; display: block; width: 18px; height: 15px; top: -10px; left: 5px; z-index: 5; background: url("https://cc-scripts.staffbase.com/graphics-asset/santa_hat.png") no-repeat center / contain; transform: rotate(18deg); pointer-events: none;}
/* Bigger hat on the desktop bell ==================*/[data-c13y-region="header"] [data-c13y-purpose="notifications"] [data-c13y-component="badge"]::before { width: 22px; height: 19px; top: -14px; left: 6px;}
/* No hat/snow in the desktop dropdown menus ============================ */[data-c13y-component="popover"] [data-c13y-component="badge"]::before { content: none;}- Click Preview to test your CSS customizations in both App and Intranet.
- Click Save.
You have customized the notification badge as a Santa hat.
Customize the notification badge to a snow-themed badge
- In the Studio, navigate to the Settings > App and Intranet.
The App and Intranet Branding page opens. - Under Custom CSS, select New UX.
- In the editor, copy and paste the following CSS lines:
If there are other code snippets in the editor, paste this CSS after the existing code and do not modify the existing code.
/* ===================================================================== OPTION 2: SNOW CAP Note: white snow looks good on a colored header (desktop), but is hard to see on the white mobile menu. ===================================================================== */
/* Move the bell counter down/left so the hat has space inside (floating menu) =========== */[data-c13y-region="header"] [data-c13y-purpose="notifications"] [data-c13y-component="badge"] { translate: -15px 3px;}
/* Same for the full-width menu ========================= */[data-c13y-region="header"][data-navigation-variant="full-width"] [data-c13y-purpose="notifications"] [data-c13y-component="badge"] { translate: -15px 4px !important;}
/* Mobile sidebar menu bubbles ================================ */[data-c13y-component="mobile-menu-item"] span[aria-label] { position: relative;}
[data-c13y-component="badge"]::before,[data-c13y-component="mobile-menu-item"] span[aria-label]::before { content: ""; position: absolute; display: block; width: 20px; height: 10px; top: -5px; left: -2px; z-index: 5; background: url("https://cc-scripts.staffbase.com/graphics-asset/snow_cap.png") no-repeat center top / contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); transform: none; pointer-events: none;}
[data-c13y-region="header"] [data-c13y-purpose="notifications"] [data-c13y-component="badge"]::before { width: 20px; height: 10px; top: -5px; left: -2px;}- Click Preview to test your CSS customizations in both App and Intranet.
- Click Save.
You have customized the notification badge as a snow badge.