# Styling Perspective Tree branches?

**URL:** <https://forum.inductiveautomation.com/t/styling-perspective-tree-branches/86074>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 21, 2024, 4:40am UTC](https://forum.inductiveautomation.com/t/styling-perspective-tree-branches/86074 "2024-02-21T04:40:48Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 25, 2024, 7:41am UTC](https://forum.inductiveautomation.com/t/styling-perspective-tree-branches/86074/5 "2024-03-25T07:41:38Z")

</div>

yeah scripts dont run on load like this, thats why i wrap my scripts in the onload of an img object

```auto
	code = """<img style='display:none' src='/favicon.ico' onload=\"
		console.log('hey');				
	\"></img>""".replace("\n", "").replace("\t", "")
	return code

```

Do note that the added a css sheet will not disspear, when closing the view, and if you open a new view a second css sheet will be made... (i think)  
Css sheets also can get cached, so this might turn out ugly after a while.

Its better to just add in a `<style>` object instead of a script (or the onload img) for css related injections. and use python to generate your style "dynamicaly"

```auto
styles=".iaDropdownCommon_options [data-label='YourLabel']:before { content: url('/system/images/Builtin/icons/16/check2.png');	}"
	code = """<style>
		"""+styles+"""
	\"></style>""".replace("\n", "").replace("\t", "")
	return code

```

> [@\[FEATURE\] Add ability to add Icon and styling to Perspective Dropdown items](https://forum.inductiveautomation.com/t/feature-add-ability-to-add-icon-and-styling-to-perspective-dropdown-items/73823/2):
>
> put this in the markdown component binding like usual you'll ofc will have to add some python logic to append the style string based on the required labels in de dropdown (idk if everyone has these Builtin/icons or is it from my test project?) styles=".iaDropdownCommon\_options [data-label='YourLabel']:before { content: url('/system/images/Builtin/icons/16/check2.png'); }" code = """\<style\> """+styles+""" \"\>\</style\>""".replace("\n", "").replace("\t", "") return code

---

_[View the full topic](https://forum.inductiveautomation.com/t/styling-perspective-tree-branches/86074)._
