0

In this StackBlitz I have a Kendo for Angular Dialog that contains a div. I need to center the dive vertically/horizontally in the Dialog area. How is this possible? I tried with "margin: auto" but did not work.

    @Component({
    selector: 'my-app',
    template: `
      <kendo-dialog [width]="340" [height]="200">
          <kendo-dialog-titlebar>
             The Title
        </kendo-dialog-titlebar>
         <div id="div1">CENTER THE DIV</div>
      </kendo-dialog>
    `,
    styles: [`
      #div1{
        width:120px;
        height: 40px;
        background-color: yellow;
      }

      `]
})
export class AppComponent {
    public opened: boolean = true;
}
ps0604
  • 1,227
  • 23
  • 133
  • 330

1 Answers1

1

Based on this thread reply, and adapted to the context of the Dialog content:

encapsulation: ViewEncapsulation.None,
styles: [`
  #div1{
    margin: auto auto;
    width:100px;
    height: 40px;
    background-color: yellow;
  }
  .k-content.k-dialog-content {
    display: flex;
  }
  `]

Modified example

topalkata
  • 2,028
  • 2
  • 12
  • 13