--- title: "Styling Basics | Docs" description: "ZingGrid components are DOM elements so you can style them as you would a native tag: with CSS selectors, pseudo-selectors, and CSS variables." url: https://www.zinggrid.com/docs/getting-started/styling-basics --- ```text experiment_id: web-retrieval-v1 fixture_id: /docs/getting-started/styling-basics.md mode: provenance representation: markdown origin_response_id: 4ca9f24f0e038660baadee7980a05ac0 version: 2026-10-21 version_created_at_utc: 2026-10-21T20:42:35.713Z version_nonce: b250e289257ee354ecfcc90152258d3a generated_at_utc: 2026-10-22T23:17:38.755Z response_nonce: 9f9ac3d8c51026d62ca318947c7d2a93 ``` # Styling Basics At its simplest, the grid components are DOM elements, **so you can style them as you would a native tag:** with CSS selectors, pseudo-selectors, and CSS variables. Our goal for ZingGrid is to make showing data in grids easy, so the same should apply for styling them. In this guide, we'll walk you through how simple it is to style your grids. ## Component Selectors The majority of the grid styling can be applied directly to the grid components themselves. **This is the suggested method to style your grids**. This includes elements like the main `` tag, the `` tag, the `` tag, etc. ### Common Component Selectors All native CSS selectors apply to ZingGrid. Pseudo-classes like `:hover` and `:nth-child` work as expected and can be used in conjunction with CSS transitions. > **Note:** Each ZingGrid component available in the Light DOM can be directly targeted in CSS. For a list of available components, view the [API Elements page](https://www.zinggrid.com/docs/api/tags/zing-grid). ## CSS Variables Of course, you'll need CSS variables with your selectors in order to style your grid. Using CSS variables in ZingGrid is just like using any CSS variable. > **Note:** If you don't know much about CSS variables, you can check out our [CSS variables usage doc](https://www.zinggrid.com/docs/api/styling/usage/). ### Sample CSS Check out the CSS below to see the most commonly used CSS selectors and variables for grid styling: ```css zing-grid { background: #eeeeee; font-size: 1.2rem; padding: 10px; box-shadow: 0 0 9px rgba(0, 0, 0, .15); } zg-caption { background-color: darkorange; color: white; font-weight: bold; opacity: 0.6; text-align: center; transition: 0.3s opacity; font-size: 2rem; } zg-caption:hover { opacity: 1; } zg-head { color: orange; } zg-cell { color: blue; transition: 1s background-color; } zg-cell:hover { background-color: orange; } zg-body zg-row:nth-child(odd) { background-color: lightblue; } ``` ## CSS Styled Grid Now, check out the demo below to see those CSS selectors and variables in action: [Example code](https://app.zingsoft.com/demos/embed/G8WS76K8) ## CSS Shadow Parts When dealing with an element within a shadow tree, use CSS shadow parts to style an exposed element (has `[part]` attribute) within the component's shadow tree. > **Note:** If you don't know much about CSS Shadow Parts, you can check out our [CSS shadow parts usage doc](https://www.zinggrid.com/docs/api/styling/usage/#css-shadow-parts). ### Sample CSS Check out the example CSS below on how to use CSS shadow parts: ```css zg-dialog::part(header) { background-color: red; } ``` ## Moving Forward There are several ways to style the grid, and they can be used in conjunction with each other. However, if you don't want to make your own style changes, we offer a [few built-in themes](https://www.zinggrid.com/docs/api-theme-variables). For a list of all the CSS variables, view the [CSS Variables API Reference](https://www.zinggrid.com/docs/api/styling/reference/).