> For the complete documentation index, see [llms.txt](https://docs.keycloakify.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keycloakify.dev/keycloakify/v10/customization-strategies/css-level-customization/page-specific-styles.md).

# Page specific styles

So far the customization we have made applies to all the pages however you might want to have stylesheet specific to certain pages.

You can do that by loading different stylesheet and applying different classes depending on the `kcContext.pageId`.

Implementation example, instead of importing our stylesheet at the top of the KcPage.tsx component file we import them dynamically:

<pre class="language-tsx" data-title="src/login/KcPage.tsx"><code class="lang-tsx">import {
    Suspense, 
    lazy,
<strong>    useMemo
</strong>} from "react";

export default function KcPage(props: { kcContext: KcContext }) {
    const { kcContext } = props;

    const { i18n } = useI18n({ kcContext });

<strong>    const classes = useCustomStyles(kcContext);
</strong>
    return (
        &#x3C;Suspense>
            {(() => {
                switch (kcContext.pageId) {
                    default:
                        return (
                            &#x3C;DefaultPage
                                kcContext={kcContext}
                                i18n={i18n}
                                classes={classes}
                                Template={Template}
                                doUseDefaultCss={true}
                                UserProfileFormFields={UserProfileFormFields}
                                doMakeUserConfirmPassword={doMakeUserConfirmPassword}
                            />
                        );
                }
            })()}
        &#x3C;/Suspense>
    );
}

<strong>function useCustomStyles(kcContext: KcContext) {
</strong><strong>    return useMemo(() => {
</strong><strong>        
</strong><strong>        // You stylesheet that applies to all pages.
</strong><strong>        import("./main.css");
</strong><strong>        let classes: { [key in ClassKey]?: string } = {
</strong><strong>            // Your classes that applies to all pages
</strong><strong>        };
</strong>
<strong>        switch (kcContext.pageId) {
</strong><strong>            case "login.ftl":
</strong><strong>                // You login page specific stylesheet.
</strong><strong>                import("./pages/login.css");
</strong><strong>                classes = {
</strong><strong>                    ...classes,
</strong><strong>                    // Your classes that applies only to the login page
</strong><strong>                };
</strong><strong>                break;
</strong><strong>            case "register.ftl":
</strong><strong>                // Your account page specific stylesheet
</strong><strong>                import("./pages/register.css");
</strong><strong>                classes = {
</strong><strong>                    ...classes,
</strong><strong>                    // Your classes that applies only to the register page
</strong><strong>                };
</strong><strong>                break;
</strong><strong>            // ...
</strong><strong>        }
</strong>
<strong>        return classes;
</strong>
<strong>    }, []);
</strong><strong>}
</strong></code></pre>

## What's next?

At this point of the documentation, if you're looking for using tailwind you can go to this page:

{% content-ref url="/pages/odEwRcRmpO50UGfysv29" %}
[Using Tailwind](/keycloakify/v10/customization-strategies/css-level-customization/using-tailwind.md)
{% endcontent-ref %}

Else you can skip directly to the next section:

{% content-ref url="/pages/jwbsGFEnYCSwTyS6xfMB" %}
[Using custom assets](/keycloakify/v10/customization-strategies/css-level-customization/using-custom-assets.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.keycloakify.dev/keycloakify/v10/customization-strategies/css-level-customization/page-specific-styles.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
