Skip to main content

CSS

Explore practical guides and implementation patterns for this topic.

Posts

Topic LWC
Lightning Web Components

How to Build a Modal Popup with an Overlay in Salesforce LWC

In plain words: A modal popup is a box that appears over your main screen, forcing the user to interact with it before they can return to the main page. In Salesforce Lightning Web Components (LWC), you can build a clean, custom modal using a simple combination of HTML for the structure, CSS for the dark background overlay, and a JavaScript boolean variable to control when it opens and closes. Modals are essential UI elements. Whether you need to ask a user to confirm a deletion, display a complex data entry form, or show a critical warning, a modal popup with a darkened background overlay focuses the user's attention exactly where you need it. In this guide, we will build a highly reusable, custom modal component from scratch and show you how to control it from a parent component.
Read article
Topic LWC
Lightning Web Components

How to Build a Dynamic Vertical Navigation Bar in Salesforce LWC

In plain words: A dynamic vertical navigation bar is a side menu where the links (like "Home", "About", and "Contact") are not hardcoded into the HTML. Instead, they are defined in JavaScript as an array. This makes it incredibly easy to add, remove, or change menu items later without having to rewrite your HTML layout. In modern web applications, a clean, intuitive navigation menu is essential. By building a vertical navigation bar using Lightning Web Components (LWC), you can create a reusable sidebar menu that perfectly matches your company's branding. In this tutorial, we will build a dynamic sidebar menu using the LWC for:each directive to loop through a list of JavaScript objects.
Read article
Topic LWC
Lightning Web Components

How to Dynamically Style Salesforce LWC Datatables with Custom CSS

In plain words: Dynamic styling in an LWC datatable means altering cell colors, badges, and fonts based on each row's underlying record data (such as painting an Error row red or a Success row green) at runtime. Standard Salesforce Lightning Web Components isolate CSS using the Shadow DOM. To style tabular cells conditionally based on record values—like rendering status indicators, alerts, or audit badges—developers can map calculated CSS classes dynamically through JavaScript getters or custom data structures.
Read article
Topic LWC
Lightning Web Components

How to Apply Dynamic Styling in Salesforce LWC (Classes, Getters & CSS Variables)

In plain words: Dynamic styling in Lightning Web Components (LWC) refers to modifying the colors, sizes, or layout of UI elements at runtime based on user actions, record data, or business logic. In Salesforce LWC, this is achieved by binding reactive JavaScript getters to the HTML class attribute or dynamically setting CSS custom properties (variables). Building responsive, user-friendly Lightning interfaces often requires visual cues like alert states, interactive toggles, or dynamic status badges. In this tutorial, you will learn standard, platform-compliant patterns for handling dynamic styling in LWC without violating Shadow DOM encapsulation.
Read article