I’m running into a CSS issue that I’m able to fix via devtools by finding the right div and applying styling directly, but I’m unable to do the same in code. The reason for this is that I use the <SplitPane>
React component, which generates it’s own divs in the DOM. For example, if my React code looked like this:
<SplitPane />
The generated DOM would look something like this
<div class="sc-iAEyYk dohjMh SplitPane vertical">
<div class="sc-beqWaB fbooqV Pane vertical">
<div class="sc-dmqHEX llsejy"></div>
<div class="sc-gueYoa fyVXeP"></div>
</div>
</div>
The library itself has some info on applying CSS to the overall SplitPane (which doesn’t fix my issue), but not the individual divs. I need to apply styling to the div labeled sc-gueYoa fyVXeP
, but I’m not sure how to target that if these are all auto-generated class names. What’s the best way to apply CSS to this div and this div alone?
2
Answers
Assuming I found the right docs, you would use pane1Style and pane2Style.
If that isn’t quite what you are looking for, you could also do a different css approach, which would look something like this:
Docs I found.
Assuming you can add a class name in the parent component (for eg: parent in code below) and you are using scss/sass you can do the following.