Try the Style tab first: colours, fonts, button shapes and per-element text styles cover most needs without code (see The widget builder). Use custom CSS for what's left — a shadow, an animation, a different layout on phones.
Add custom CSS
- Open the widget in the builder and go to the Layout tab.
- Open Advanced at the bottom and type your rules into Custom CSS.
- The preview updates as you type. Click Publish Changes when it looks right.
Your CSS is kept apart from the Style tab's choices, so picking a new look later doesn't overwrite it.
/* A soft shadow and a slower hover on the main button */
#widget-main-button {
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
transition: transform 0.2s ease;
}
#widget-main-button:hover {
transform: translateY(-2px);
}Give an element an ID
An element ID lets your CSS target one part of the widget. It becomes the element's HTML id, so you style it with #your-id. Element IDs are set in the classic builder:
- In the builder, open More actions (⋯) and choose Open in Classic Builder. Publish or discard your changes first — unpublished changes don't carry over.
- On the Build tab, click the element.
- Under Design, type an Element ID, like
widget-main-button. Use letters, numbers and hyphens, and make it unique on the page. - Optionally, type CSS declarations under Style, such as
color: red; font-size: 16px;— they apply to that element only. - Save with Update and Close.
Why your site's CSS doesn't apply
Forms, inline banners and bars are drawn in their own isolated part of the page (a shadow root). That protects them from your theme — a stray rule in your stylesheet can't break their layout — but it also means a rule in your site's CSS file won't reach inside them. Put widget styles in the widget's own Custom CSS.
Popups: keep every rule scoped. A popup's custom CSS is added to your page while the popup is shown. A broad rule like button { … } would restyle your site's buttons too. Start every rule with an ID from inside your popup.
Style phones separately
Use a media query for small screens, and check the result with the Phone preview in the builder.
@media (max-width: 600px) {
#widget-headline {
font-size: 22px;
}
#widget-main-button {
width: 100%;
}
}Some phone settings need no code: Inner spacing on phones on the Layout tab, and Hide on phones for a photo on the Style tab.
Tips
- Target your own IDs, not the widget's built-in class names — those can change when CROforce updates how widgets are drawn.
- If a rule doesn't apply, a more specific built-in style may win. Make your selector more specific before reaching for
!important. - Deleting an element also removes the styles the Style tab set for it.
Next steps
- The widget builder: The Style and Layout tabs.
- Elements reference: Every element and its settings.
- Popup layout and position: Size, position and backdrop without code.
Frequently asked questions
Why doesn't my website's CSS change my widget?
Forms, banners and bars are drawn in their own isolated part of the page, so your site's stylesheet can't reach inside them — and their styles can't break your page. Put the CSS in the widget's Custom CSS instead.
Will picking a new look on the Style tab wipe my CSS?
No. The Style tab's choices are kept apart from your Custom CSS.
Is an element ID the same as the Element IDs on the Display tab?
No. The Display tab asks for the ID of an element on your own page, such as a button that should open a popup. An element ID in this article is one you give to a part of the widget, so your CSS can target it.
