You can find the classes by inspecting the HTML elements in browser.
You can add custom CSS to ms-HorizontalNavItem-link
class like given below to change the font size of menu item text:
.ms-HorizontalNavItem-link {
font-size: 20px
}
You can add additional styles to menu items as per your requirements.
To add custom CSS on modern pages, you have two options:
- Use SPFx application customizer to inject CSS on all modern pages
- Use Modern script editor web part to inject CSS on single modern page
More information about injecting CSS: How can I include the same JS and CSS files on multiple SharePoint Modern Page?
Note: DOM manipulation & CSS customizations are not recommended by Microsoft and some of your customization may break if Microsoft changes HTML element id/classes in new release updates.