angular 2 material container fixed not working

后端 未结 1 1229
萌比男神i
萌比男神i 2021-01-26 17:36

i have problem with css and angular 2 material. Any fixed positioned element doesn\'t behave like it is fixed inside md-sidenav-container.If it is not inside container, it works

相关标签:
1条回答
  • 2021-01-26 17:58

    I can't tell if it is a bug or an expected behaviour, but I faced the same problem a few months ago. The solution I found was to set the css property height: 100% on the following tags (assuming your sidenav is your root level) : html, body, main.

    You need to put inside the <md-sidenav-container> tag every element you want to be fixed, and it should work.

    I would have liked to edit your plunker but, for some reasons, systemJS seems to produce a weird DOM (there are more than one <html>, <body>, etc tags). You will need to set height: 100% on every parent tag of your <md-sidenav-container>

    EDIT

    Looks like I forgot to mention <md-sidenav-container> needs to get height: 100% too. About your double scrollbar, try to set overflow-y: auto on <md-sidenav-container>.

    However it may not solve your problem, due to the particular DOM of systemJS. If you don't especially need it, I would suggest you to dump it and try a project without systemJS. If you do, I'm afraid I wont be able to help you further.

    0 讨论(0)
提交回复
热议问题