# Code Block with Dynamic Data

{% embed url="<https://youtu.be/4LJCa_3yQc4>" %}

Using dynamic data inside Bricks' Code Block is the most powerful and flexible way to control a block. You can allow users to control those dynamic data by exposing Dynamic Data as a form field in Gutenberg editor.&#x20;

### Use {gb\_block\_id} to scope block CSS properly

To have CSS to select a specific block, you can use {gb\_block\_id}. In the example below, the specific CSS is only applied to a block with class `.block-{gb_block_id}`

<pre class="language-css"><code class="lang-css">.block-{gb_block_id} .brxe-rating .full-color {
  color: {gbmeta_star_rating_color};
<strong>}
</strong></code></pre>

IMPORTANT: You MUST add `block-{gb_block_id}` to a parent element by using Dynamic Class.

<figure><img src="/files/kC7cp59teP0o5icsLSGg" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gutenbricks.com/features/code-block-with-dynamic-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
