> For the complete documentation index, see [llms.txt](https://docs.webstudio.is/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.webstudio.is/university/foundations/copy-paste/html-with-css.md).

# HTML with CSS

Paste HTML with style blocks and convert CSS classes into Webstudio styles.

When you paste HTML that includes `<style>` blocks, Webstudio extracts the CSS rules and converts class-based selectors into [design tokens](https://docs.webstudio.is/university/foundations/design-tokens.md). Use this when you want pasted markup to become editable Webstudio components instead of remaining embedded code.

## How to paste HTML with CSS

1. Copy HTML that includes a `<style>` block.
2. Paste it onto the canvas in Webstudio.
3. Webstudio creates the component structure and applies matching class styles as reusable style tokens.

If a nested selector references elements not present in the pasted HTML, Webstudio shows a notification listing the skipped selectors.

If the pasted HTML/CSS references image URLs, such as `<img src="...">` or `background-image: url(...)`, Webstudio uploads those images into [Assets](https://docs.webstudio.is/university/foundations/assets.md) and rewrites the pasted components/styles to use the uploaded assets.

## Related

* [CSS](https://docs.webstudio.is/university/foundations/copy-paste/css.md) – Paste CSS declarations into the Style Panel
* [HTML with Tailwind](https://docs.webstudio.is/university/foundations/copy-paste/html-with-tailwind.md) – Paste HTML containing Tailwind utility classes
* [Referenced images](https://docs.webstudio.is/university/foundations/copy-paste/images.md) – Understand image handling during paste
* [Design tokens](https://docs.webstudio.is/university/foundations/design-tokens.md) – Learn how reusable style packages work
* [HTML Embed](https://docs.webstudio.is/university/core-components/html-embed.md) – Embed custom HTML when you do not need native Webstudio components


---

# 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.webstudio.is/university/foundations/copy-paste/html-with-css.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.
