我正在尝试在页面上设置ng-侧边栏,虽然可以正常工作,但侧边栏没有背景,并且无法在CSS中为其分配颜色。我已经能够通过chrome中的inspect元素分配背景色。我的代码如下:
模块
@NgModule({
declarations: [ImageBrowseSidebarComponent],
imports: [
CommonModule,
FormsModule,
SidebarModule.forRoot()
],
exports: [ImageBrowseSidebarComponent]
})
export class ImageBrowseSidebarModule {
}
html
<ng-sidebar-container style="height: 100em">
<ng-sidebar [(opened)]="_opened">
test
</ng-sidebar>
<div ng-sidebar-content>
<button (click)="_toggleSidebar()">Toggle sidebar</button>
</div>
</ng-sidebar-container>
css
.ng-sidebar{
background-color: darkslategray !important;
}
答案 0 :(得分:0)
要更改侧边栏的背景,您可以执行以下操作:
::ng-deep aside {
background-color:#FF0000;
padding: 2em 1em;
}
答案 1 :(得分:-1)
SCSS
ng-sidebar-container {
aside.ng-sidebar {
background-color: darkslategray !important;
}
}