Ways to adjust the font size of mat-menu-item?

I came across a query regarding this matter on another platform:

How can the font size of mat-menu-item be changed to small in Angular?

Unfortunately, the solution provided did not work for me.

I attempted to implement the suggested code in my Angular application, but the font size of mat-menu-item remained unchanged.

SCSS

.mat-menu-item{
  font-size: 9px;
}

Markup

<button [matMenuTriggerFor]="menu" mat-button>Options</button>
<mat-menu class="mat-menu" #ServicesButton #menu="matMenu">
  <button class="mat-menu-item" mat-menu-item>Option 1</button>
  <button class="mat-menu-item" mat-menu-item>Option 2</button>
  <button class="mat-menu-item" mat-menu-item>Option 3</button>
  <button class="mat-menu-item" mat-menu-item>Option 4</button>
</mat-menu>

I also tried the following approach

<mat-menu class="mat-menu" #ServicesButton #menu="matMenu">
  <button style="font-size: 9px;" mat-menu-item>Option 1</button>
  <button style="font-size: 9px;" mat-menu-item>Option 2</button>
  <button style="font-size: 9px;" mat-menu-item>Option 3</button>
  <button style="font-size: 9px;" mat-menu-item>Option 4</button>
</mat-menu>

Is there an alternative way to achieve the same effect by utilizing regular HTML like

<li>Option 1</li><li>Option 2</li>
instead of using .mat-menu-item?

Answer №1

It is recommended to incorporate the following CSS rule into your styles.css file:

.mat-mdc-menu-item span{
    font-size: 40px;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Scanning for devices on Ionic 2/3 made simple: How to easily exclude unwanted application and Android directories

I'm currently working on a gallery application that enables users to choose images from their phone and transfer them to a kiosk. Upon loading the application, it searches the entire device for folders containing images and organizes them into an albu ...

HTML links remain enclosed in a box even after the code has been finalized

Hey there, I have written this code and for some reason, every link shared after it is displaying with a black background. I'm new to coding and can't seem to figure out what I'm doing wrong. Any help would be greatly appreciated. a:link, ...

Setting background colors for classes based on an array

I have a total of six div elements on a single page, all sharing the same class. My goal is to give each one a unique color from an array I have prepared. I want to avoid any repetition of colors among these divs. Currently, I have managed to assign backg ...

Show the cell data when the checkbox next to it is selected

I have a specific table setup and I am trying to display the content of the table cell if its corresponding checkbox is checked upon clicking a button. For example: If Row2 is checked, an alert box should display Row2 Below is my code snippet, Java ...

Issue with dropdown menu display in Internet Explorer

Having trouble with a CSS dropdown menu displaying incorrectly in IE, while working fine on other browsers. <body> <div id="container"> <header> <div id="hlogo"> <a href="index.html">title ...

What are the steps to connecting incoming data to an Angular view utilizing a reactive form?

Hello, I am currently fetching data from an API and have successfully displayed the teacher values. However, I am unsure of how to utilize the incoming array values for "COURSES" in my Angular view. This is the response from the REST API: { "courses ...

Overflow scroll block containing a table within a div element

I am working on displaying a loop of records fetched from the database. I want to place these records inside a div block with overflow so that users can scroll through a long list easily. However, when I try to implement the below code, the appearance of t ...

Is it considered a bad practice to apply overflow: auto to all elements with the exception of html?

My approach to beginning a new design always involves overriding the default padding and margin set by the browser on all elements: * { margin: 0; padding: 0; } After coming across j08691's response regarding a margin collapse issue, I discovered th ...

Exploring the functionalities of can-deactivate without incorporating routing

I'm facing an issue with a parent component and multiple child components. The parent component contains a form, while each child component also has its own form. Unfortunately, all child components share the same route as the parent component and hav ...

JavaScript failing to load following PHP header() redirect

I've set up a page that allows users to sign in by filling out a basic form, which then sends the data to a separate PHP script for validation. After the validation process is complete, the PHP script uses the header() function to redirect the user to ...

Customized height for vertical Slick slider based on content length

I am facing an issue with my vertical slick slider: $('.slider').slick({ slidesToShow: 3, slidesToScroll: 1, arrows: false, dots: false, infinite: false, centerMode: true, vertical: true, focusOnSelect: true }); .slider { bac ...

Having trouble with your CSS dropdown menu?

I've been struggling to implement a dropdown menu on my website following an online tutorial. Despite following the steps, I can't seem to get it working. It's frustrating because I want to move on to backend development. Hoping someone can ...

What is the best way to ensure a division's height matches that of the window using CSS?

Is it possible to create a division that covers the total width and height of the screen using just CSS without relying on JavaScript or jQuery? <div id="all"></div> I have tried setting the width and height of the element to 100%, but I am s ...

Display a single div and conceal the rest upon clicking a link

Trying to find a way to hide all other divs when clicking on a navbar link to toggle them. Currently, the divs stay active when a new link is clicked. The goal is for them to slide up and the clicked one to slide down. <script type="text/javascript> ...

When you click on an anchor tag, the divs do not automatically move to the top of the page

Encountering an issue with a rather straightforward website. It consists of a vertical scroll with a left side navigation. Whenever I click on a menu item, it fails to bring the corresponding section to the top of the page. I've experimented with a fe ...

Effortlessly apply CSS styles to multiple cached jQuery variables without redundancy

Hey there, I've got this piece of code written in Javascript for a classic ASP page. Since there are no CSS classes defined, everything is handled within the Javascript itself. var $a= $('#a'), $v= $('#v'), $s= $('#s'), ...

Enhancing a bootstrap gallery with a zoom in effect

I need help creating a gallery using Bootstrap that resembles the style shown in this example: While everything is functional, I am facing an issue with aligning the pictures properly after adding a hover effect. I tried placing each picture in individual ...

The specified function is not recognized within the HTMLButtonElement's onclick event in Angular 4

Recently diving into Angular and facing a perplexing issue: "openClose is not defined at HTMLButtonElement.onclick (index:13)" Even after scouring through various resources, the error seems to be rooted in the index page rather than within any of the app ...

Clicking within the text activates the dropdown menu, but clicking outside the text does not

My custom drop down menu is not functioning properly. When I click on the text, it successfully links to another place, but when I click beside the text, it does not link. Can you please help me identify what's wrong here? Your assistance would be gre ...

What is the method for incorporating an upward arrow into a select element, while also including a downward arrow, in order to navigate through options exclusively with

I have a select element that I have styled with up and down arrows. However, I am seeking assistance to navigate the options dropdown solely using these arrows and hide the dropdown list. Here is the HTML: <div class="select_wrap"> <d ...