问题
I have a website that is using Angular material. I like elements and everything except default font sizes and elements are huge. To see website in acceptable scale me or my users have to zoom out at least 75% on the desktop and majority of my users are desktop users. Is there a way to specify in angular material to use smaller fonts, elements, etc?
回答1:
in your main css file
add following
html {
font-size: 62.5% // adjust the size with percentage here.
}
and i recommend using em
and rem
for font-sizing
let me know if it didn't worked, i might provide another solution
回答2:
Before you attempt anything, make sure you are using the correct fonts and font sizes by following the typography guide.
Font sizes can be adjusted by customizing the typography. Changing the size of elements is technically possible, but to do it you would need to override the styles for every Angular Material component - so it is highly impractical.
Also, component sizes as well as font sizes are determined by the Material Design specifications, so changing things means you are no longer properly following the specification, and IMO you would end up with a bad looking web site (at least bad looking in terms of following Material Design).
来源:https://stackoverflow.com/questions/50378844/angular-material-elements-fonts-are-too-big-for-desktop-use