---
description: Code blocks are elements that contain code or styles
---

# Creating Code Blocks

Code blocks are simply elements that contain code or styles.&#x20;

Once you create a code block you add it to an artboard and that code is added to your exported page.&#x20;

For example, if you wanted to make the page background black you could add the CSS to the code block:&#x20;

```
<style>
body {
   background-color: black;
}
</style>
```

To create a code block:&#x20;

1. Add an any element to the artboard. I recommend a Text field.&#x20;
2. In the Element Properties dialog or panel expand the Markup Inside field
3. Enter the markup, code or style you want to add to the page
4. Click OK
5. Add it to the desired artboard

Optionally you can make this a component and reuse it across multiple artboards and projects.

And optionally, you can set the tag name to "none" to prevent the enclosing tag to be exported.&#x20;

#### Example Project

[https://github.com/velara3/xd-examples/tree/master/web-export/examples/code-blocks](https://github.com/velara3/xd-examples/tree/master/web-export/examples/code-blocks)
