如何在子div元素内显示primeNg侧边栏?



这是我的代码

<div style="  background-color: yellow; height: 350px; padding-top: 45%;">
<p-button
type="button"
(click)="visibleSidebar1 = true"
icon="pi pi-arrow-right">
</p-button>
<div style="background-color: green; height: 250px;">
<p-sidebar [(visible)]="visibleSidebar1" [baseZIndex]="10000">
<h1 style="font-weight:normal">Left Sidebar</h1>
</p-sidebar>

</div>
</div>

我在子元素里面使用了侧边栏,但是它显示在子元素外面。就像这个边栏在

外面但是我想在子元素(绿色区域)内显示侧栏。像这样,这是我期望的

有办法做到这一点吗?我stackBlitz

请在您的" 'srcstyle . CSS";文件

p-sidebar div.p-sidebar 
{    
position: relative !important;
}

最新更新