---
title: "Use CSS in a web experiment"
slug: "use-css-in-a-web-experiment"
abstract: "Describes how to use a Cascading Style Sheet (CSS) in a web experiment to apply your organization's branding."
---
# Use CSS in a web experiment

You can use a Cascading Style Sheet (CSS) in a web experiment to apply your organization's colors, fonts, layouts and branding to the experiment.

You can also edit the CSS in a variant for an experiment for facilitating 1:1 personalization by running dynamic data. To do this, you must [configure the API response](https://doc.sitecore.com/personalize/en/users/sitecore-personalize/introduction-to-experiments-in-sitecore-personalize/introduction-to-web-experiments-in-sitecore-personalize/compose-the-api-request-for-a-web-experiment.html "Compose the API request for a web experiment") to include the dynamic data so that when the variant executes, the data is requested from the server and then passed to the variant.

To use CSS in a web experiment:

1. In the **Experiment variants** tile, click the **Edit** icon next to the variant you want to configure.
2. In the code editor, on the **CSS** tab, enter any CSS that you want to use to format the layout of the web experiment.
3. To insert dynamic data into CSS, on the **Data** tab, in the **Data Selector** search box, enter a guest's email address or other identifier to search. This enables you to access data model attributes and paths.

    > [!tip]
    > If there is a guest whose data you often use when configuring or testing code, click the star icon to bookmark the guest so you no longer have to search for them.

    ![Editing the HTML to apply personalization in a variant.](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/Use_CSS_custom_code.png)

4. To include dynamic guest data, under the **Guest data model** tree, click ![Copy icon](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/copy_data.png) and click **Copy Path as Handlebars**.
5. To include dynamic data from the decision model response, expand the **Decision Model Response** tree, click ![Copy icon](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/copy_data.png) and click **Copy Path as Handlebars**.
6. To include dynamic data from the experience response, expand the **Experience Response** tree, click ![Copy icon](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/copy_data.png) and click **Copy Path as Handlebars**.
7. On the **CSS** tab, paste the data and prefix it with `context`. For example, to include the data in `{{decisionOffers.0.attributes.PromoText}}` in the CSS, you must reference it as `{{context.decisionOffers.0.attributes.PromoText}}`.
8. Click **Save**.
9. Click ![back.png](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/back.png) to close the code editor.

> [!note]
> If you use an out-of-the-box web template, or if you have copied the JavaScript from such a template, you must reference an attribute from the API response within a `context` object. For example, to include in the CSS an `imageURL` from the API response, reference it as follows:
>
> background-image: url(“{{context.imageURL}}”)