I want to change the display style inside of the #shadow-root and am having some trouble targeting it. First question, is it possible to target it through CSS? Or is it better to do it through JS?
#retirement-services-modal #rs-two-col::shadow(.wrapper) {
display: flex;
align-items: center;
}
<div id="retirement-services-modal">
<sdf-layout-two-col id="rs-two-col">
#shadow-root
<div class="wrapper">
<div class="col-1">content goes here</div>
<div class="col-2">content goes here</div>
</div>
</sdf-layout-two-col>
</div>
I am trying to target the .wrapper
inside the #shadow-root
to add a display: flex;
and align-items: center;
.
I tried to target it with ::shadow
but that did not seem to work. I also tried ::part
but that did not seem to work either. Are there any other ways to target it through CSS?
2
Answers
it may be more efficient and easier to use JS to target and manipulate the content.
Here is an example using
part
Note: Above Declarative shadowDOM notation
shadowrootmode
is not available in FireFox yet:https://caniuse.com/declarative-shadow-dom