md-menu can't set max-width
See original GitHub issueBug
I’m trying to override the default 280px max-width of the .mat-menu-panel
but it doesn’t work.
i’m using the latest 2.0.0-beta.3 cesium-cephalopod version, with chrome browser
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:8 (5 by maintainers)
Top Results From Across the Web
md-menu override default max-width in Angular 2
I'm using Angular 2 , Angular Material and I am willing to display more data in a md-menu and, therefore, I need to...
Read more >Css – md-menu override default max-width in Angular 2
I'm using Angular 2 , Angular Material and I am willing to display more data in a md-menu and, therefore, I need to...
Read more >Max-Width - Tailwind CSS
Setting the maximum width. Set the maximum width of an element using the max-w-{size} utilities.
Read more >Set width of menu on split-pane - Ionic Forum
Hi, I'm looking a way to set the max-width of the SplitPane The auto-size function is ... .md { ion-menu { max-width: 15%!important;...
Read more >CSS · Bootstrap
Using a single set of .col-md-* grid classes, you can create a basic grid system that starts out stacked on mobile devices and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you! I’ve improved my example to better describe my problem. Now the toggle button is aligned to the right and the menu panel gets cut. If I use
.cdk-overlay-container .mat-menu-panel
instead of.cdk-overlay-container .mat-menu-panel.my-menu
as the css selector, it works. But I want to apply it only with my specific.my-menu
class.It seems like the menu-panel is being positioned before
my-menu
class is added.here is the code
First, in your plunker, your stylesheet isn’t being included in the component. You must add the stylesheet to
styleUrls
.Second, unfortunately you won’t be able to override the menu panel with your component styles due to view encapsulation. You will need to either turn view encapsulation off for this component or add the override styles to your global stylesheet.
Third, in order to actually override the styles on
.mat-menu-panel
, you’ll need to either use!important
or increase your specificity by using multiple selectors, like.mat-menu-panel.my-overriden-menu
.https://plnkr.co/edit/iJH8g9y3wEyXQEPSiJ4C?p=preview
All that having been said, menu width should be more easily adjustable. The spec claims that it must be an increment of 56px, but the 280px max is only for mobile screens.