# Styling observable Plot with css/style

**URL:** <https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403>\
**Category:** Help\
**Created:** [October 20, 2023, 10:29pm UTC](https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403 "2023-10-20T22:29:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rusosnith](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/rusosnith/32/6367_2.png) [@rusosnith](https://talk.observablehq.com/u/rusosnith)\
**Post date:** [October 20, 2023, 10:29pm UTC](https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403/1 "2023-10-20T22:29:37Z")

</div>

I’m trying to nudge some details on facet labels or other texts in Observable Plot using the style option and/or external CSS but couldn’t find many references and the only one ([Plots | Observable Plot](https://observablehq.com/plot/features/plots#other-options)) it’s pretty scarce…

I know Plot is not supposed to be used for “end user” but sometimes even for data exploring some visual/reading touchup is needed!

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [October 20, 2023, 10:49pm UTC](https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403/2 "2023-10-20T22:49:16Z")

</div>

Can you share more details about what you’re trying to do?

In general, I recommend inspecting the SVG element hierarchy generated by Plot in your browser’s developer tools. You can also use these tools to apply styles manually and see how they look. And then once you get a sense for what you want, you can translate those styles into selectors and then apply them either via an external stylesheet or using Plot’s top-level **style** option.

Here are three examples:

> **[Plot: Custom styles](https://observablehq.com/@observablehq/plot-custom-styles)**
>
> Ref. https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403

---

<div class="post-metadata">

**Author:** ![rusosnith](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/rusosnith/32/6367_2.png) [@rusosnith](https://talk.observablehq.com/u/rusosnith)\
**Post date:** [October 21, 2023, 1:19am UTC](https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403/3 "2023-10-21T01:19:00Z")

</div>

Thanks for the samples!

I used that kind of workaround but ended up realizing that when trying to embed the plot somewhere else with the javascript option, the CSS gets lost in the middle, so I was trying to figure out how to use the Plot´s “style” internal option instead, and found no samples on that!

---

<div class="post-metadata">

**Author:** ![mauforonda](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mauforonda/32/8133_2.png) [@mauforonda](https://talk.observablehq.com/u/mauforonda)\
**Post date:** [October 26, 2023, 2:57am UTC](https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403/4 "2023-10-26T02:57:16Z")

</div>

Hola Ruso, you can declare style rules in a cell and then add that cell to your embed.

For example, this [notebook](https://observablehq.com/@mauforonda/datos-geograficos-del-gobierno-boliviano) features a cell called `stylesheet` with all my css wrapped in an html block. I then embed a selection of cells including `stylesheet` [here](https://mauforonda.github.io/geodatos/). This embed retains all my style rules fine.

Hope it helps 🙂

---

<div class="post-metadata">

**Author:** ![rusosnith](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/rusosnith/32/6367_2.png) [@rusosnith](https://talk.observablehq.com/u/rusosnith)\
**Post date:** [October 26, 2023, 4:59pm UTC](https://talk.observablehq.com/t/styling-observable-plot-with-css-style/8403/5 "2023-10-26T16:59:29Z")

</div>

awesome example thanks!
