.newsider {
&:global(.ant-menu) {
padding-top: 0;
}
}
this way, the generated class name in your html element will be something like this(one way to improve your css specificity):
.src-widget-side-nav-s-module__newsider--mTBFz.ant-menu {
padding-top: 0;
}
In other cases, the target may be a descendant css class, you can adjust like this:
.newSider {
:global(.ant-menu-submenu-vertical) {
:global(i.ant-menu-submenu-arrow::before) {
transform: rotate(-45deg) translateX(-4px) !important;
}
}
}
Selectors in the :global()
is just normal selectors you would use, can be a combined selector too:
&:global(.ant-menu-item-selected a) {
font-weight: bold;
color: rgba(0, 0, 0, 0.87);
}
More about symbols in Less
In the above first example, &
here represents a parent selector of this nested format, namely .newsider
selector. learn parent selector
~
is another symbol in less for escaping
&-extra {
margin: @result-extra-margin;
text-align: center;
> * {
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
}
In this snippet, what is does is to set .parentSelector-extra
element’s style, > *
means selector of all children element of .parentSelector-extra
, and inside this the &:last-child
means the last children of .parentSelector-extra
.