Menu for BLAZOR - How to change the color of the menu items?

1 Answer 2122 Views
Menu
Satish
Top achievements
Rank 1
Iron
Satish asked on 17 Nov 2021, 04:48 PM | edited on 17 Nov 2021, 04:48 PM

I have the following code.  Currently it renders menus in Orange color by default.  How to customize the item color to WHITE and make it BOLD?

<div style="width: 100%; margin: 0 auto; background-color:gray;">
    <TelerikMenu Data="@MenuItems" Class="centered-menu"
        UrlField="@nameof(MenuItem.Page)"
        ItemsField="@nameof(MenuItem.SubSectionList)"
        TextField="@nameof(MenuItem.Section)">
    </TelerikMenu>
</div>

My CSS:

.k-menu.centered-menu,
::deep .k-menu.centered-menu {
    justify-content: center;
}

 It renders:

1 Answer, 1 is accepted

Sort by
1
Accepted
Dimo
Telerik team
answered on 18 Nov 2021, 08:29 AM

Hello Satish,

The Menu root item color is set in our theme with a specificity of 0,3,0 (three CSS classes). To override it, you need to use the same or higher specificity, for example:

(in the .razor file - same specificity)

.centered-menu.k-menu .k-item {
  color: white;
  font-weight: bold;
}

(OR in the .razor.css file - higher specificity, due to the ::deep dynamic selector)

::deep .centered-menu.k-menu .k-item {
  color: white;
  font-weight: bold;
}

Regards,
Dimo
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Menu
Asked by
Satish
Top achievements
Rank 1
Iron
Answers by
Dimo
Telerik team
Share this question
or