# Override css variables ionic v4

**URL:** <https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485>\
**Category:** Ionic Framework\
**Created:** [July 27, 2018, 2:20pm UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485 "2018-07-27T14:20:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteobattista](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/matteobattista/32/120669_2.png) [@matteobattista](https://forum.ionicframework.com/u/matteobattista)\
**Post date:** [July 27, 2018, 2:20pm UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485/1 "2018-07-27T14:20:31Z")

</div>

Hi… is there a best way to override css default setting?  
e.g. $split-pane-md-side-min-width

And is it possible also override default item-native behavior… If I don’t set color on ion-item, a background #f1f1f1 color is set on click and remain setted if my click remain on the element.

Thank you

---

<div class="post-metadata">

**Author:** ![ChrisGriiffith](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/chrisgriiffith/32/66576_2.png) [@ChrisGriiffith](https://forum.ionicframework.com/u/ChrisGriiffith)\
**Post date:** [July 27, 2018, 3:22pm UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485/2 "2018-07-27T15:22:14Z")

</div>

CSS Variable documentation is still being worked on during the beta. I have been diving through the source code to find them currently (but I am an writing a book on Ionic 4)…

Chris  
[http://ionic-book.com/](http://ionic-book.com/)

---

<div class="post-metadata">

**Author:** ![btsiders](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/btsiders/32/101172_2.png) [@btsiders](https://forum.ionicframework.com/u/btsiders)\
**Post date:** [August 17, 2018, 3:41pm UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485/3 "2018-08-17T15:41:42Z")

</div>

I had the same question. It didn’t look like there was any way to override the `$split-pane-md-side-min-width` SASS variable from our side any longer, so I had to change the way I was doing that. Instead of overriding the SASS var, and since there wasn’t a corresponding CSS var (yet?), I was able to use this in my global.scss file:

```css
ion-menu.main {
  min-width: 304px !important;
}

```

I specifically added the `main` class to my menu. You could target it in other ways, or even just use `ion-menu { ... }` if you only have one…

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [August 17, 2018, 4:01pm UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485/4 "2018-08-17T16:01:48Z")

</div>

Hi

see [https://developer.mozilla.org/en-US/docs/Web/CSS/Using\_CSS\_variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables)

[https://www.w3schools.com/css/css3\_variables.asp](https://www.w3schools.com/css/css3_variables.asp)

And if you watch Josh Morony’s last blog on Ionic 4 you can easily see how to scope it and find the variables eligible for overriding.

> **[Styling a Shadow DOM in Ionic 4](https://www.joshmorony.com/styling-a-shadow-dom-in-ionic-4/)**
>
> Since the release of Ionic 4, many of Ionic’s components now make use of a Shadow DOM. I’ve written about what exactly this means in another article, but the basic idea is that a Shadow…

Basically the documentation may not guide you, but even if it would, I think it will be better to use the inspector to find the latest overview of variables you can use (as they can change faster then the docs)

In @matteobattista case: make a split pane in Ionic 4. Use the inspector to find the element you want to style, use search to filter for `--` leading variables and hope you find the one you need.

Tom

---

<div class="post-metadata">

**Author:** ![matteobattista](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/matteobattista/32/120669_2.png) [@matteobattista](https://forum.ionicframework.com/u/matteobattista)\
**Post date:** [August 20, 2018, 11:02am UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485/5 "2018-08-20T11:02:45Z")

</div>

Thank you for the link… for my question, it seams that for ion-split-pane there are no css variable exposed… maybe in the future?

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [August 20, 2018, 11:29am UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485/6 "2018-08-20T11:29:58Z")

</div>

Submit an issue or PR on ionic github

Or hack it in the ionic split-pane code yourself, and manage all subsequent updates

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:28pm UTC](https://forum.ionicframework.com/t/override-css-variables-ionic-v4/136485/7 "2021-07-19T21:28:44Z")

</div>

Closed on July 19, 2021, 9:28pm UTC


